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

Function object_to_trace_string

Core/SoarKernel/src/trace.cpp:1620–1679  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1618}
1619
1620growable_string object_to_trace_string(agent* thisAgent, Symbol* object)
1621{
1622 growable_string gs;
1623 int type_of_object;
1624 trace_format* tf;
1625 Symbol* name;
1626 struct tracing_parameters saved_tparams;
1627
1628 /* --- If it's not an identifier, just print it as an atom. Also, if it's
1629 already being printed, print it as an atom to avoid getting into an
1630 infinite loop. --- */
1631 if ((object->symbol_type != IDENTIFIER_SYMBOL_TYPE) ||
1632 (object->tc_num == thisAgent->tf_printing_tc))
1633 {
1634 gs = make_blank_growable_string(thisAgent);
1635 add_to_growable_string(thisAgent, &gs, symbol_to_string(thisAgent, object, true, NIL, 0));
1636 return gs;
1637 }
1638
1639 /* --- mark it as being printed --- */
1640 object->tc_num = thisAgent->tf_printing_tc;
1641
1642 /* --- determine the type and name of the object --- */
1643 if (object->id->isa_goal)
1644 {
1645 type_of_object = FOR_STATES_TF;
1646 }
1647 else if (object->id->isa_operator)
1648 {
1649 type_of_object = FOR_OPERATORS_TF;
1650 }
1651 else
1652 {
1653 type_of_object = FOR_ANYTHING_TF;
1654 }
1655
1656 name = find_name_of_object(thisAgent, object);
1657
1658 /* --- find the trace format to use --- */
1659 tf = find_appropriate_trace_format(thisAgent, false, type_of_object, name);
1660
1661 /* --- now call trace_format_list_to_string() --- */
1662 if (tf)
1663 {
1664 saved_tparams = tparams;
1665 tparams.current_s = tparams.current_o = NIL;
1666 tparams.allow_cycle_counts = false;
1667 gs = trace_format_list_to_string(thisAgent, tf, object);
1668 tparams = saved_tparams;
1669 }
1670 else
1671 {
1672 /* --- no applicable trace format, so just print the object itself --- */
1673 gs = make_blank_growable_string(thisAgent);
1674 add_to_growable_string(thisAgent, &gs, symbol_to_string(thisAgent, object, true, NIL, 0));
1675 }
1676
1677 object->tc_num = 0; /* unmark it now that we're done */

Callers 4

add_trace_for_wmeFunction · 0.85
print_object_traceFunction · 0.85

Calls 6

add_to_growable_stringFunction · 0.85
symbol_to_stringFunction · 0.85
find_name_of_objectFunction · 0.85

Tested by

no test coverage detected