1 { Copyright (C) 2005 Bas Steendijk
\r
2 For conditions of distribution and use, see copyright notice in zlib_license.txt
\r
3 which is included in the package
\r
4 ----------------------------------------------------------------------------- }
\r
15 tlinklist=class(tobject)
\r
19 destructor destroy; override;
\r
22 {linklist with 2 links}
\r
23 tlinklist2=class(tlinklist)
\r
28 {linklist with one pointer}
\r
29 tplinklist=class(tlinklist)
\r
33 tstringlinklist=class(tlinklist)
\r
37 tthing=class(tlinklist)
\r
38 name:ansistring; {name/nick}
\r
39 hashname:integer; {hash of name}
\r
43 adding new block to list (baseptr)
\r
45 procedure linklistadd(var baseptr:tlinklist;newptr:tlinklist);
\r
46 procedure linklistdel(var baseptr:tlinklist;item:tlinklist);
\r
49 procedure linklist2add(var baseptr,newptr:tlinklist2);
\r
50 procedure linklist2del(var baseptr:tlinklist2;item:tlinklist2);
\r
53 linklistdebug:integer;
\r
59 procedure linklistadd(var baseptr:tlinklist;newptr:tlinklist);
\r
63 if (newptr=baseptr) or assigned(newptr.prev) then raise exception.create('linklist double insertion detected');
\r
66 baseptr.prev := nil;
\r
68 if p <> nil then p.prev := baseptr;
\r
71 procedure linklistdel(var baseptr:tlinklist;item:tlinklist);
\r
73 if item = baseptr then baseptr := item.next;
\r
74 if item.prev <> nil then item.prev.next := item.next;
\r
75 if item.next <> nil then item.next.prev := item.prev;
\r
80 procedure linklist2add(var baseptr,newptr:tlinklist2);
\r
84 if (newptr=baseptr) or assigned(newptr.prev2) then raise exception.create('linklist2 double insertion detected');
\r
87 baseptr.prev2 := nil;
\r
89 if p <> nil then p.prev2 := baseptr;
\r
92 procedure linklist2del(var baseptr:tlinklist2;item:tlinklist2);
\r
94 if item = baseptr then baseptr := item.next2;
\r
95 if item.prev2 <> nil then item.prev2.next2 := item.next2;
\r
96 if item.next2 <> nil then item.next2.prev2 := item.prev2;
\r
101 constructor tlinklist.create;
\r
104 inc(linklistdebug);
\r
107 destructor tlinklist.destroy;
\r
109 dec(linklistdebug);
\r