home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
cpm
/
turbopas
/
zxref.lbr
/
XREF3.IQC
/
XREF3.INC
Wrap
Text File
|
1986-09-30
|
3KB
|
131 lines
(**************************************************)
(*-------> Include file #3 for XREF.PAS ,=======*)
(**************************************************)
(* v. 0300pm, sun, 28.Sep.86, Glen Ellis *)
(*--------------------------------------------*)
(* *)
(* primary procedure is pPrintTree *)
(* *)
(*--------------------------------------------*)
procedure pPrintTree( Tree : TreePointer );
(*
(* GLOBAL
(* MaxOnLine = max line references per line
(* NumberWidth = field for each number
(* *)
VAR
Pageposition: PageIndex;
(*-----------------------------*)
(* sub procedure of pPrintTree *)
procedure pPage(var fx: text);
begin
writeln(fx);
write(fx, FormFeedChar);
end;
(*-----------------------------*)
(* sub procedure of pPrintTree *)
procedure pPrintEntry
(subTree: TreePointer; VAR position: PageIndex);
VAR
ix: WordIndex;
Itemcount : 0..Maxlinelen;
Itemptr : QueuePointer;
(*------------------------------*)
(* sub procedure of pPrintEntry *)
procedure pPrintLine
(VAR Currentposition: PageIndex; newlines: PageIndex);
VAR
LineCounter : PageIndex;
begin
IF (Currentposition + newlines) < MaxOnPage then
begin
FOR lineCounter:=1 to newlines
do WriteLn(XOut);
Currentposition := Currentposition + newlines;
end
ELSE
begin
pPage(XOut);
WriteLn(XOut,HeadIng);
FOR lineCounter := 1 TO HeadIngsize - 1
do WriteLn(XOut);
Currentposition := HeadIngsize + 1;
end
end;{pPrintLine}
(*-----------------------------*)
(* sub procedure of pPrintTree *)
begin (* pPrintEntry *)
IF subTree<>nil then
WITH subTree^
do
begin
pPrintEntry(left,position);
pPrintLine(position,EntryGap + 1);
WITH entry
do
begin
FOR ix := 1 to length(WordValue)
do Write(XOut, WordValue[ix]);
Write(XOut, space:(MaxWordLen-length(WordValue)));
Itemcount := 0;
Itemptr := FirstInQueue;
WHILE Itemptr <> nil
do
begin
Itemcount := Itemcount + 1;
IF Itemcount > MaxOnLine then
begin
pPrintLine(position,1);
Write(XOut, space:MaxWordlen);
Itemcount := 1;
end;
Write(XOut, Itemptr^.linenumber: numberwidth);
Itemptr := Itemptr^.NextInQueue;
end; (* WHILE *)
end; (* WITH entry *)
pPrintEntry(right,position);
end; (* WITH subTree^ *)
end; (* pPrintEntry *)
(*--------------------------------------------*)
(* *)
(* primary procedure is pPrintTree *)
(* *)
(*--------------------------------------------*)
begin (* procedure pPrintTree *)
PagePosition := MaxOnPage;
pPrintEntry(Tree,PagePosition);
end; (* pPrintTree *) { CLOSE(XrfID) ; }
(***************************************************************)