home *** CD-ROM | disk | FTP | other *** search
- Unit NodeSort;
-
- INTERFACE
-
- Uses DoubLink;
-
- Type
- NodeSortFunc = Function (D1,D2 : D_Node) : Boolean;
-
- {NodeSortFuncs *MUST* be declared such that they return the truth value}
- {of the boolean comparison D1 > D2 as you wish to define it. }
- {Several NodeSortFuncs are predefined below to demonstrate. }
-
- Var
- RealGreater : NodeSortFunc;
- IntGreater : NodeSortFunc;
-
- IMPLEMENTATION
- {$F+}
-
- Function RealG (D1,D2 : D_Node) : Boolean;
- Var
- R1,R2 : Real;
- Begin
- D1.Get_Data (R1,SizeOf(R1));
- D2.Get_Data (R2,SizeOf(R2));
- RealG := R1 > R2
- End;
-
- Function IntG (D1,D2 : D_Node) : Boolean;
- Var
- R1,R2 : Integer;
- Begin
- D1.Get_Data (R1,SizeOf(R1));
- D2.Get_Data (R2,SizeOf(R2));
- IntG := R1 > R2
- End;
-
- (*
- Function RecordGreater (D1,D2 : D_Node) : Boolean;
- Var
- R1,R2 : SomeRecordType;
- Begin
- D1.Get_Data (R1,SizeOf(R1));
- D2.Get_Data (R2,SizeOf(R2));
- RecordGreater := R1.SomeField > R2.SomeField
- End;
- *)
-
- {$F-}
- BEGIN
- RealGreater := RealG;
- IntGreater := IntG;
- END.