home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / GENERI.ZIP / GENLIST.ARC / NODESORT.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-07-24  |  1.0 KB  |  55 lines

  1. Unit NodeSort;
  2.  
  3. INTERFACE
  4.  
  5. Uses DoubLink;
  6.  
  7. Type
  8.   NodeSortFunc = Function (D1,D2 : D_Node) : Boolean;
  9.  
  10.   {NodeSortFuncs *MUST* be declared such that they return the truth value}
  11.   {of the boolean comparison D1 > D2 as you wish to define it.           }
  12.   {Several NodeSortFuncs are predefined below to demonstrate.            }
  13.  
  14. Var
  15.   RealGreater : NodeSortFunc;
  16.   IntGreater  : NodeSortFunc;
  17.  
  18. IMPLEMENTATION
  19. {$F+}
  20.  
  21. Function RealG (D1,D2 : D_Node) : Boolean;
  22. Var
  23.   R1,R2 : Real;
  24. Begin
  25.   D1.Get_Data (R1,SizeOf(R1));
  26.   D2.Get_Data (R2,SizeOf(R2));
  27.   RealG := R1 > R2
  28. End;
  29.  
  30. Function IntG (D1,D2 : D_Node) : Boolean;
  31. Var
  32.   R1,R2 : Integer;
  33. Begin
  34.   D1.Get_Data (R1,SizeOf(R1));
  35.   D2.Get_Data (R2,SizeOf(R2));
  36.   IntG := R1 > R2
  37. End;
  38.  
  39. (*
  40. Function RecordGreater (D1,D2 : D_Node) : Boolean;
  41. Var
  42.   R1,R2 : SomeRecordType;
  43. Begin
  44.   D1.Get_Data (R1,SizeOf(R1));
  45.   D2.Get_Data (R2,SizeOf(R2));
  46.   RecordGreater := R1.SomeField > R2.SomeField
  47. End;
  48. *)
  49.  
  50. {$F-}
  51. BEGIN
  52.   RealGreater := RealG;
  53.   IntGreater  := IntG;
  54. END.
  55.