{==============================================================}
{			IXDIAG.PAS			       }
{Copyright (C) 1986 David E. Cortesi--see notice in IXMAIN.PAS.}
{ This include file contains a diagnostic procedure that will  }
{ display a binary tree of index terms.  The call "diag(t)" -- }
{ where t is of type tree as defined in IXMAIN -- can be inser-}
{ ted temporarily for diagnostic purposes in the code.	The    }
{ include-command in IXMAIN should be disabled (by changing    }
{ its dollar-sign to something else) unless a diag() call is   }
{ actually in use.					       }
{ History:						       }
{ initial code 11/2/86					       }
{==============================================================}
{-- recursive tree display ----}
procedure tdiag(t:tree;n:tdepth);
var j:strlength;
begin
    if (t <> nil) then tdiag(t^.cnodes[right],n+1);
    for j := 0 to n-1 do write('   ');
    write('|-- ');
    if (t <> nil) then begin
	stget(t^.term,scratch);
	j := 1;
	while(scratch[j] <> null) do begin
	    write(chr(scratch[j]));
	    j := j+1;
	end
    end
    else write('*');
    writeln;
    if (t <> nil) then tdiag(t^.cnodes[left],n+1);
end;

{--- sets up the recursive display, waits afterward ----}
procedure diag(t:tree);
var c : char;
begin
    writeln; writeln('DIAGNOSTIC DISPLAY');
    tdiag(t,0);
    writeln('press return');
    readln(c)
end;
char;