home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / TURBOPAS / ZXREF.LBR / XREF3.IQC / XREF3.INC
Text File  |  2000-06-30  |  3KB  |  131 lines

  1.  
  2. (**************************************************)
  3. (*-------> Include file  #3  for XREF.PAS ,=======*)
  4. (**************************************************)
  5.  
  6.  
  7. (* v. 0300pm, sun, 28.Sep.86, Glen Ellis *)
  8.  
  9. (*--------------------------------------------*)
  10. (*                                            *)
  11. (*     primary procedure is pPrintTree        *)
  12. (*                                            *)
  13. (*--------------------------------------------*)
  14.  
  15. procedure pPrintTree( Tree : TreePointer );
  16.  
  17. (*
  18. (* GLOBAL
  19. (*      MaxOnLine   = max line references per line
  20. (*      NumberWidth = field for each number
  21. (* *)
  22.  
  23. VAR
  24.   Pageposition: PageIndex;
  25.  
  26.  
  27. (*-----------------------------*)
  28. (* sub procedure of pPrintTree *)
  29.  
  30. procedure pPage(var fx: text);
  31.  
  32. begin
  33.    writeln(fx);
  34.    write(fx, FormFeedChar);
  35. end;
  36.  
  37.  
  38. (*-----------------------------*)
  39. (* sub procedure of pPrintTree *)
  40.  
  41. procedure pPrintEntry
  42. (subTree: TreePointer; VAR position: PageIndex);
  43.  
  44. VAR
  45.    ix: WordIndex;
  46.    Itemcount : 0..Maxlinelen;
  47.    Itemptr : QueuePointer;
  48.  
  49.  
  50. (*------------------------------*)
  51. (* sub procedure of pPrintEntry *)
  52.  
  53. procedure pPrintLine
  54. (VAR Currentposition: PageIndex; newlines: PageIndex);
  55.  
  56. VAR
  57.    LineCounter : PageIndex;
  58.  
  59. begin
  60.    IF (Currentposition + newlines) < MaxOnPage then
  61.    begin
  62.       FOR lineCounter:=1 to newlines
  63.          do WriteLn(XOut);
  64.       Currentposition := Currentposition + newlines;
  65.    end
  66.    ELSE
  67.    begin
  68.       pPage(XOut);
  69.       WriteLn(XOut,HeadIng);
  70.       FOR lineCounter := 1 TO HeadIngsize - 1
  71.          do WriteLn(XOut);
  72.       Currentposition := HeadIngsize + 1;
  73.    end
  74. end;{pPrintLine}
  75.  
  76.  
  77. (*-----------------------------*)
  78. (* sub procedure of pPrintTree *)
  79.  
  80. begin  (* pPrintEntry *)
  81.  
  82.    IF subTree<>nil then
  83.    WITH subTree^
  84.    do
  85.    begin
  86.       pPrintEntry(left,position);
  87.       pPrintLine(position,EntryGap + 1);
  88.       WITH entry
  89.       do
  90.       begin
  91.          FOR ix := 1 to length(WordValue)
  92.             do  Write(XOut, WordValue[ix]);
  93.          Write(XOut, space:(MaxWordLen-length(WordValue)));
  94.          Itemcount := 0;
  95.          Itemptr := FirstInQueue;
  96.          WHILE Itemptr <> nil
  97.          do
  98.          begin
  99.             Itemcount := Itemcount + 1;
  100.             IF Itemcount > MaxOnLine then
  101.             begin
  102.                pPrintLine(position,1);
  103.                Write(XOut, space:MaxWordlen);
  104.                Itemcount := 1;
  105.             end;
  106.             Write(XOut, Itemptr^.linenumber: numberwidth);
  107.             Itemptr := Itemptr^.NextInQueue;
  108.          end;  (* WHILE *)
  109.       end; (* WITH entry *)
  110.       pPrintEntry(right,position);
  111.    end; (* WITH subTree^ *)
  112. end; (* pPrintEntry *)
  113.  
  114.  
  115. (*--------------------------------------------*)
  116. (*                                            *)
  117. (*     primary procedure is pPrintTree        *)
  118. (*                                            *)
  119. (*--------------------------------------------*)
  120.  
  121. begin   (* procedure pPrintTree *)
  122.  
  123.    PagePosition := MaxOnPage;
  124.  
  125.    pPrintEntry(Tree,PagePosition);
  126.  
  127. end; (* pPrintTree *)  { CLOSE(XrfID) ; }
  128.  
  129.  
  130. (***************************************************************)
  131.