MCPcopy Create free account
hub / github.com/GJDuck/e9patch / getCSVValue

Function getCSVValue

src/e9tool/e9csv.cpp:265–284  ·  view source on GitHub ↗

* Lookup a value from a CSV file. */

Source from the content-addressed store, hash-verified

263 * Lookup a value from a CSV file.
264 */
265MatchVal getCSVValue(intptr_t addr, const char *basename, uint16_t idx)
266{
267 static Cache cache;
268 auto r = cache.emplace(std::piecewise_construct,
269 std::make_tuple(basename), std::make_tuple());
270 Data &data = r.first->second;
271 if (r.second)
272 {
273 std::string filename(basename);
274 filename += ".csv";
275 parseCSV(filename.c_str(), data);
276 }
277 auto i = data.find(addr);
278 if (i == data.end())
279 return MatchVal();
280 const Record &record = i->second;
281 if (idx >= record.size())
282 return MatchVal();
283 return record[idx];
284}
285
286/*
287 * Specialized parser for lists of addresses.

Callers 3

makeMatchValueFunction · 0.85
sendLoadArgumentMetadataFunction · 0.85
sendArgumentDataMetadataFunction · 0.85

Calls 5

parseCSVFunction · 0.85
MatchValClass · 0.85
findMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected