home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / PJ8_3.ZIP / UITEM.PAS < prev    next >
Pascal/Delphi Source File  |  1990-02-15  |  994b  |  60 lines

  1. (* uitem.pas -- (c) 1989 by Tom Swan *)
  2.  
  3. unit uitem;
  4.  
  5. interface
  6.  
  7. type
  8.  
  9.    itemPtr = ^item;
  10.    item = object
  11.       left, right : itemPtr;
  12.       constructor init;
  13.       destructor done; virtual;
  14.       procedure link( ip : itemPtr );
  15.       procedure unlink;
  16.       procedure processItem; virtual;
  17.    end;
  18.  
  19. implementation
  20.  
  21. { ----- Initialize a new item object to point to itself. }
  22.  
  23. constructor item.init;
  24. begin
  25.    left := @self;
  26.    right := @self;
  27. end;
  28.  
  29. { ----- Dispose item object's memory. }
  30.  
  31. destructor item.done;
  32. begin
  33. end;
  34.  
  35. { ----- Link item to another item addressed by ip. }
  36.  
  37. procedure item.Link( ip : itemPtr );
  38. begin
  39.    right := ip;
  40.    left := ip^.left;
  41.    ip^.left^.right := @self;
  42.    ip^.left := @self;
  43. end;
  44.  
  45. { ----- Unlink an item if it's linked to another. }
  46.  
  47. procedure item.Unlink;
  48. begin
  49.    left^.right := right;
  50.    right^.left := left;
  51. end;
  52.  
  53. { ----- Process contents of item. }
  54.  
  55. procedure item.processItem;
  56. begin
  57. end;
  58.  
  59. end.
  60.