diff -r 000000000000 -r 509e4801c378 srcanamdw/appdep/src/appdep_cache.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/srcanamdw/appdep/src/appdep_cache.cpp Sat Jan 09 10:04:12 2010 +0530 @@ -0,0 +1,557 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Cache handling routines +* +*/ + + +#include "appdep.hpp" + + +// ---------------------------------------------------------------------------------------------------------- + +void ReadDataFromSymbolTablesCache(target& a_target) +{ + string line; + + ifstream symtabcachef(a_target.st_cache_path.c_str()); + if (!symtabcachef.is_open()) + { + cerr << "Warning: Regenerating corrupted cache of target " << a_target.name << endl; + a_target.cache_files_valid = false; + _some_cache_needs_update = true; + return; + } + + getline(symtabcachef, line); + if (line != CACHE_ST_HEADER) + { + cerr << "Warning: Regenerating corrupted cache of target " << a_target.name << endl; + a_target.cache_files_valid = false; + _some_cache_needs_update = true; + } + else + { + // loop through all lines in the file + while(!symtabcachef.eof()) + { + getline(symtabcachef, line); + + if (line.length() > 0 && line[0] != CACHE_COMMENT_CHAR) + { + // first entry is the directory|filename|modification_time|symbol_table_size , eg + // x:\epoc32\release\armv5\urel\|avkon.dll|1160666488|178 + string::size_type delim1 = line.find(CACHE_SEP, 0); + string::size_type delim2 = line.find(CACHE_SEP, delim1+1); + string::size_type delim3 = line.find(CACHE_SEP, delim2+1); + + import_library_info lib_info; + lib_info.directory = line.substr(0, delim1); + lib_info.filename = line.substr(delim1+1, delim2-delim1-1); + lib_info.mod_time = Str2Int( line.substr(delim2+1, delim3-delim2-1) ); + unsigned int symbol_table_size = Str2Int( line.substr(delim3+1, line.length()-delim3-1) ); + + // get symbol table + vector symbol_table; + for (unsigned int j=0; j 0 && line[0] != CACHE_COMMENT_CHAR) + { + // first entry is the directory|filename|binary_format|uid1|uid2|uid3|secureid|vendorid|capabilities|min_heap_size|max_heap_size|stack_size|modification_time|number_of_dependencies , eg + // x:\epoc32\release\armv5\urel\|about.exe|EPOC Exe for ARMV4 CPU|0x1000007a|0x100039ce|0x10005a22|0x10005a22|0x101fb657|782384|4096|1048576|8192|1160666488|11 + string::size_type delim1 = line.find(CACHE_SEP, 0); + string::size_type delim2 = line.find(CACHE_SEP, delim1+1); + string::size_type delim3 = line.find(CACHE_SEP, delim2+1); + string::size_type delim4 = line.find(CACHE_SEP, delim3+1); + string::size_type delim5 = line.find(CACHE_SEP, delim4+1); + string::size_type delim6 = line.find(CACHE_SEP, delim5+1); + string::size_type delim7 = line.find(CACHE_SEP, delim6+1); + string::size_type delim8 = line.find(CACHE_SEP, delim7+1); + string::size_type delim9 = line.find(CACHE_SEP, delim8+1); + string::size_type delim10 = line.find(CACHE_SEP, delim9+1); + string::size_type delim11 = line.find(CACHE_SEP, delim10+1); + string::size_type delim12 = line.find(CACHE_SEP, delim11+1); + string::size_type delim13 = line.find(CACHE_SEP, delim12+1); + + binary_info b_info; + b_info.directory = line.substr(0, delim1); + b_info.filename = line.substr(delim1+1, delim2-delim1-1); + b_info.binary_format = line.substr(delim2+1, delim3-delim2-1); + b_info.uid1 = line.substr(delim3+1, delim4-delim3-1); + b_info.uid2 = line.substr(delim4+1, delim5-delim4-1); + b_info.uid3 = line.substr(delim5+1, delim6-delim5-1); + b_info.secureid = line.substr(delim6+1, delim7-delim6-1); + b_info.vendorid = line.substr(delim7+1, delim8-delim7-1); + b_info.capabilities = Str2Int( line.substr(delim8+1, delim9-delim8-1) ); + b_info.min_heap_size = Str2Int( line.substr(delim9+1, delim10-delim9-1) ); + b_info.max_heap_size = Str2Int( line.substr(delim10+1, delim11-delim10-1) ); + b_info.stack_size = Str2Int( line.substr(delim11+1, delim12-delim11-1) ); + b_info.mod_time = Str2Int( line.substr(delim12+1, delim13-delim12-1) ); + unsigned int number_of_deps = Str2Int( line.substr(delim13+1, line.length()-delim13-1) ); + + vector deps; + for (unsigned int j=0; j imps; + for (unsigned int k=0; k symbol_table; + + if (_cl_print_debug) + cerr << "Processing " << a_target.release_lib_dir << a_target.lib_files.at(i) << "..."; + + // if not generating a clean cache, check if this file was already in the cache + if (!_cl_generate_clean_cache) + { + // first try to find existing file + bool update_file = false; + int position = 0; + + for (unsigned int j=0; j symbol_table = a_target.import_libraries.at(i).symbol_table; + + symtabcachef << a_target.import_libraries.at(i).directory << CACHE_SEP << a_target.import_libraries.at(i).filename << CACHE_SEP + << a_target.import_libraries.at(i).mod_time << CACHE_SEP << symbol_table.size() << endl; + + for (unsigned int j=0; j deps = a_target.binaries.at(i).dependencies; + + depcachef << a_target.binaries.at(i).directory << CACHE_SEP << a_target.binaries.at(i).filename << CACHE_SEP + << a_target.binaries.at(i).binary_format << CACHE_SEP << a_target.binaries.at(i).uid1 << CACHE_SEP + << a_target.binaries.at(i).uid2 << CACHE_SEP << a_target.binaries.at(i).uid3 << CACHE_SEP + << a_target.binaries.at(i).secureid << CACHE_SEP << a_target.binaries.at(i).vendorid << CACHE_SEP + << a_target.binaries.at(i).capabilities << CACHE_SEP << a_target.binaries.at(i).min_heap_size << CACHE_SEP + << a_target.binaries.at(i).max_heap_size << CACHE_SEP << a_target.binaries.at(i).stack_size << CACHE_SEP + << a_target.binaries.at(i).mod_time << CACHE_SEP << deps.size() << endl; + + for (unsigned int j=0; j imps = deps.at(j).imports; + + depcachef << deps.at(j).filename << CACHE_SEP << imps.size() << endl; + + for (unsigned int k=0; k