| 1679 | } |
| 1680 | |
| 1681 | growable_string selection_to_trace_string(agent* thisAgent, |
| 1682 | Symbol* object, |
| 1683 | Symbol* current_state, |
| 1684 | int selection_type, |
| 1685 | bool allow_cycle_counts) |
| 1686 | { |
| 1687 | trace_format* tf; |
| 1688 | Symbol* name; |
| 1689 | growable_string gs; |
| 1690 | struct tracing_parameters saved_tparams; |
| 1691 | |
| 1692 | /* --- find the problem space name --- */ |
| 1693 | name = NIL; |
| 1694 | |
| 1695 | /* --- find the trace format to use --- */ |
| 1696 | tf = find_appropriate_trace_format(thisAgent, true, selection_type, name); |
| 1697 | |
| 1698 | /* --- if there's no applicable trace format, print nothing --- */ |
| 1699 | if (!tf) |
| 1700 | { |
| 1701 | return make_blank_growable_string(thisAgent); |
| 1702 | } |
| 1703 | |
| 1704 | /* --- save/restore tparams, and call trace_format_list_to_string() --- */ |
| 1705 | saved_tparams = tparams; |
| 1706 | tparams.current_s = tparams.current_o = NIL; |
| 1707 | if (current_state) |
| 1708 | { |
| 1709 | tparams.current_s = current_state; |
| 1710 | if (current_state->id->operator_slot->wmes) |
| 1711 | { |
| 1712 | tparams.current_o = current_state->id->operator_slot->wmes->value; |
| 1713 | } |
| 1714 | } |
| 1715 | tparams.allow_cycle_counts = allow_cycle_counts; |
| 1716 | gs = trace_format_list_to_string(thisAgent, tf, object); |
| 1717 | tparams = saved_tparams; |
| 1718 | |
| 1719 | return gs; |
| 1720 | } |
| 1721 | |
| 1722 | /* ====================================================================== |
| 1723 | Printing Object and Stack Traces |
no test coverage detected