1 #include <portability.h>
36 #include "soar_TraceNames.h"
38 using namespace soar_TraceNames;
83 #define add_to_grounds(thisAgent, cond) { \
84 if ((cond)->bt.wme_->grounds_tc != thisAgent->grounds_tc) { \
85 (cond)->bt.wme_->grounds_tc = thisAgent->grounds_tc; \
86 push (thisAgent, (cond), thisAgent->grounds); } }
88 #define add_to_potentials(thisAgent, cond) { \
89 if ((cond)->bt.wme_->potentials_tc != thisAgent->potentials_tc) { \
90 (cond)->bt.wme_->potentials_tc = thisAgent->potentials_tc; \
91 (cond)->bt.wme_->chunker_bt_pref = (cond)->bt.trace; \
92 push (thisAgent, (cond), thisAgent->positive_potentials); \
93 } else if ((cond)->bt.wme_->chunker_bt_pref != (cond)->bt.trace) { \
94 push (thisAgent, (cond), thisAgent->positive_potentials); } }
96 #define add_to_locals(thisAgent, cond) { \
97 if ((cond)->bt.wme_->locals_tc != thisAgent->locals_tc) { \
98 (cond)->bt.wme_->locals_tc = thisAgent->locals_tc; \
99 (cond)->bt.wme_->chunker_bt_pref = (cond)->bt.trace; \
100 push (thisAgent, (cond), thisAgent->locals); \
101 } else if ((cond)->bt.wme_->chunker_bt_pref != (cond)->bt.trace) { \
102 push (thisAgent, (cond), thisAgent->locals); } }
108 if ((cond)->bt.wme_->grounds_tc != thisAgent->
grounds_tc) {
109 (cond)->bt.wme_->grounds_tc = thisAgent->
grounds_tc;
115 if ((cond)->bt.wme_->potentials_tc != thisAgent->
potentials_tc) {
117 (cond)->bt.wme_->chunker_bt_pref = (cond)->bt.trace;
119 }
else if ((cond)->bt.wme_->chunker_bt_pref != (cond)->bt.trace) {
125 if ((cond)->bt.wme_->locals_tc != thisAgent->
locals_tc) {
126 (cond)->bt.wme_->locals_tc = thisAgent->
locals_tc;
127 (cond)->bt.wme_->chunker_bt_pref = (cond)->bt.trace;
129 }
else if ((cond)->bt.wme_->chunker_bt_pref != (cond)->bt.trace) {
130 push (thisAgent, (cond), thisAgent->
locals); }
167 print (thisAgent,
" ");
168 print_wme (thisAgent, (static_cast<condition *>(c->
first))->bt.wme_);
186 list *grounds_to_print, *pots_to_print, *locals_to_print, *negateds_to_print;
187 Bool need_another_pass;
194 print (thisAgent,
"... BT through instantiation of ");
200 else xml_att_val(thisAgent, kProduction_Name,
"[dummy production]");
210 print_string (thisAgent,
"(We already backtraced through this instantiation.)\n");
211 xml_att_val(thisAgent, kBacktracedAlready,
"true");
221 temp_explain_backtrace.
trace_cond = trace_cond;
222 if (trace_cond == NULL)
249 need_another_pass =
FALSE;
286 while (need_another_pass) {
289 need_another_pass =
FALSE;
299 need_another_pass =
TRUE;
305 grounds_to_print =
NIL;
307 locals_to_print =
NIL;
308 negateds_to_print =
NIL;
346 push (thisAgent, c, grounds_to_print);
348 else if (c->
bt.
level <= grounds_level) {
352 push (thisAgent, c, pots_to_print);
358 push (thisAgent, c, locals_to_print);
367 push (thisAgent, c, negateds_to_print);
381 pots_to_print,locals_to_print,negateds_to_print);
393 print (thisAgent,
"\n");
399 print (thisAgent,
"\n");
405 print (thisAgent,
"\n");
411 print (thisAgent,
"\n");
417 for (not1=inst->
nots; not1!=
NIL; not1=not1->
next) {
434 free_list (thisAgent, negateds_to_print);
452 print_string (thisAgent,
"\n\n*** Tracing Locals ***\n");
456 while (thisAgent->
locals) {
470 static_cast<goal_stack_level>(grounds_level+1));
552 cons *c, *next_c, *prev_c;
554 Bool need_another_pass;
557 print_string (thisAgent,
"\n\n*** Tracing Grounded Potentials ***\n");
566 need_another_pass =
TRUE;
567 while (need_another_pass) {
568 need_another_pass =
FALSE;
585 need_another_pass =
TRUE;
613 cons *c, *next_c, *prev_c, *prohibits;
619 print_string (thisAgent,
"\n\n*** Tracing Ungrounded Potentials ***\n");
631 static_cast<goal_stack_level>(grounds_level+1));
634 c->
rest = pots_to_bt; pots_to_bt = c;
651 pots_to_bt = pots_to_bt->
rest;
655 print_string (thisAgent,
"\nFor ungrounded potential ");
661 static_cast<goal_stack_level>(grounds_level+1));
697 push (thisAgent, c, negated_to_print);
699 print_string (thisAgent,
"\n*** Chunk won't be formed due to local negation in backtrace ***\n");