1 #include <portability.h>
89 while (prod != NULL) {
135 prev = next = top =
NIL;
137 for (cc=top_list; cc!=
NIL; cc=cc->
rest) {
245 while (top != NULL) {
266 while (chunk != NULL) {
267 if (strcmp(chunk->
name,name) == 0)
272 print(thisAgent,
"Could not find the chunk. Maybe explain was not on when it was created.");
274 print (thisAgent,
"\nTo turn on explain: save-backtraces --enable before the chunk is created.\n");
296 print(thisAgent,
"Could not find this condition.\n");
310 print(thisAgent,
"Chunk : %s\n",chunk->
name);
312 while (prod != NULL) {
316 print(thisAgent,
"Trace condition : ");
320 print(thisAgent,
"The result preference is not stored, sorry.\n");
329 prod = prod -> next_backtrace;
330 print(thisAgent,
"\n\n");
359 for (cond=cond_list; cond!=NULL; cond=cond->
next) {
385 while (prod != NULL && match == NULL)
394 print(thisAgent,
"EXPLAIN: Error, couldn't find the ground condition\n");
398 print(thisAgent,
"Explanation of why condition ");
400 print(thisAgent,
" was included in %s\n\n",chunk_name);
404 print(thisAgent,
" which caused\n");
416 while (prod->
result ==
FALSE && count < 50 && match != NULL) {
420 while (prod != NULL && match == NULL) {
430 print(thisAgent,
"EXPLAIN : Unable to find which production matched condition ");
432 print(thisAgent,
"\nTo help understand what happened here and help debug this\n");
433 print(thisAgent,
"here is all of the backtracing information stored for this chunk.\n");
434 print(thisAgent,
"\n");
440 print(thisAgent,
" which caused\n");
446 print(thisAgent,
"A result to be generated.\n");
448 print(thisAgent,
"EXPLAIN: Exceeded 50 productions traced through, so terminating now.\n");
464 if (chunk == NULL)
return;
466 ground =
find_ground(thisAgent, chunk,cond_number);
467 if (ground ==
NIL)
return;
486 if (chunk == NULL)
return;
490 print (thisAgent,
"(sp %s\n ", chunk->
name);
492 print (thisAgent,
"\n-->\n ");
494 print(thisAgent,
")\n\n");
501 for (cond = chunk->
conds; cond !=
NIL; cond = cond->
next) {
502 i++;
print(thisAgent,
" %2d : ",i);
505 print(thisAgent,
" ");
507 print(thisAgent,
" Ground :");
509 print(thisAgent,
"\n");
527 print (thisAgent,
"No chunks/justifications built yet!\n");
529 print(thisAgent,
"List of all explained chunks/justifications:\n");
530 while (chunk != NULL) {
531 print(thisAgent,
"Have explanation for %s\n",chunk->
name);
548 while (chunk != NULL) {