MCPcopy Create free account
hub / github.com/DFHack/dfhack / df_clearvec

Function df_clearvec

plugins/devel/vectors.cpp:267–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265}
266
267command_result df_clearvec (color_ostream &con, vector <string> & parameters)
268{
269 if (parameters.size() == 0)
270 {
271 clearUsage(con);
272 return CR_FAILURE;
273 }
274
275 uintptr_t start = 0, bytes = 0;
276
277 if (!hexOrDec(parameters[0], start))
278 {
279 vectorsUsage(con);
280 return CR_FAILURE;
281 }
282
283 if (!hexOrDec(parameters[1], bytes))
284 {
285 vectorsUsage(con);
286 return CR_FAILURE;
287 }
288
289 std::vector<t_memrange> ranges;
290
291 if (!getRanges(con, ranges))
292 {
293 return CR_FAILURE;
294 }
295
296 for (size_t i = 0; i < parameters.size(); i++)
297 {
298 std::string addr_str = parameters[i];
299 uintptr_t addr;
300 if (!hexOrDec(addr_str, addr))
301 {
302 con << "'" << addr_str << "' not a number." << std::endl;
303 continue;
304 }
305
306 if (addr % 4 != 0)
307 {
308 con << addr_str << " not 4 byte aligned." << std::endl;
309 continue;
310 }
311
312 if (!inAnyRange(ranges, (void *) addr))
313 {
314 con << addr_str << " not in any valid address range." << std::endl;
315 continue;
316 }
317
318 bool valid = false;
319 bool ptr = false;
320 t_vecTriplet* vec = (t_vecTriplet*) addr;
321
322 if (mightBeVec(ranges, vec))
323 valid = true;
324 else

Callers

nothing calls this directly

Calls 7

clearUsageFunction · 0.85
hexOrDecFunction · 0.85
vectorsUsageFunction · 0.85
getRangesFunction · 0.85
inAnyRangeFunction · 0.85
mightBeVecFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected