MCPcopy Create free account
hub / github.com/SoarGroup/Soar / add_trace_for_attribute_path

Function add_trace_for_attribute_path

Core/SoarKernel/src/trace.cpp:1301–1372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1299---------------------------------------------------------------- */
1300
1301void add_trace_for_attribute_path(agent* thisAgent,
1302 Symbol* object,
1303 list* path,
1304 growable_string* result,
1305 bool print_attributes,
1306 bool recursive)
1307{
1308 growable_string values;
1309 cons* c;
1310 char* ch;
1311 int count;
1312 slot* s;
1313 wme* w;
1314
1315 values = make_blank_growable_string(thisAgent);
1316
1317 if (! path)
1318 {
1319 if (object->symbol_type != IDENTIFIER_SYMBOL_TYPE)
1320 {
1321 return;
1322 }
1323 for (s = object->id->slots; s != NIL; s = s->next)
1324 for (w = s->wmes; w != NIL; w = w->next)
1325 {
1326 add_trace_for_wme(thisAgent, &values, w, print_attributes, recursive);
1327 }
1328 for (w = object->id->impasse_wmes; w != NIL; w = w->next)
1329 {
1330 add_trace_for_wme(thisAgent, &values, w, print_attributes, recursive);
1331 }
1332 for (w = object->id->input_wmes; w != NIL; w = w->next)
1333 {
1334 add_trace_for_wme(thisAgent, &values, w, print_attributes, recursive);
1335 }
1336 if (length_of_growable_string(values) > 0)
1337 {
1338 add_to_growable_string(thisAgent, result, text_of_growable_string(values) + 1);
1339 }
1340 free_growable_string(thisAgent, values);
1341 return;
1342 }
1343
1344 count = 0;
1345 add_values_of_attribute_path(thisAgent, object, path, &values, recursive, &count);
1346 if (! count)
1347 {
1348 found_undefined = true;
1349 free_growable_string(thisAgent, values);
1350 return;
1351 }
1352
1353 if (print_attributes)
1354 {
1355 add_to_growable_string(thisAgent, result, "^");
1356 for (c = path; c != NIL; c = c->rest)
1357 {
1358 ch = symbol_to_string(thisAgent, static_cast<symbol_struct*>(c->first), true, NULL, 0);

Callers 1

Calls 7

add_trace_for_wmeFunction · 0.85
add_to_growable_stringFunction · 0.85
text_of_growable_stringFunction · 0.85
free_growable_stringFunction · 0.85
symbol_to_stringFunction · 0.85

Tested by

no test coverage detected