2 { Copyright (C) 2005 Bas Steendijk
\r
3 For conditions of distribution and use, see copyright notice in zlib_license.txt
\r
4 which is included in the package
\r
5 ----------------------------------------------------------------------------- }
\r
16 tlinklist=class(tobject)
\r
20 destructor destroy; override;
\r
23 {linklist with 2 links}
\r
24 tlinklist2=class(tlinklist)
\r
29 {linklist with one pointer}
\r
30 tplinklist=class(tlinklist)
\r
34 tstringlinklist=class(tlinklist)
\r
38 tthing=class(tlinklist)
\r
39 name:string; {name/nick}
\r
40 hashname:integer; {hash of name}
\r
44 adding new block to list (baseptr)
\r
46 procedure linklistadd(var baseptr:tlinklist;newptr:tlinklist);
\r
47 procedure linklistdel(var baseptr:tlinklist;item:tlinklist);
\r
50 procedure linklist2add(var baseptr,newptr:tlinklist2);
\r
51 procedure linklist2del(var baseptr:tlinklist2;item:tlinklist2);
\r
54 linklistdebug:integer;
\r
60 procedure linklistadd(var baseptr:tlinklist;newptr:tlinklist);
\r
64 if (newptr=baseptr) or assigned(newptr.prev) then raise exception.create('linklist double insertion detected');
\r
67 baseptr.prev := nil;
\r
69 if p <> nil then p.prev := baseptr;
\r
72 procedure linklistdel(var baseptr:tlinklist;item:tlinklist);
\r
74 if item = baseptr then baseptr := item.next;
\r
75 if item.prev <> nil then item.prev.next := item.next;
\r
76 if item.next <> nil then item.next.prev := item.prev;
\r
81 procedure linklist2add(var baseptr,newptr:tlinklist2);
\r
85 if (newptr=baseptr) or assigned(newptr.prev2) then raise exception.create('linklist2 double insertion detected');
\r
88 baseptr.prev2 := nil;
\r
90 if p <> nil then p.prev2 := baseptr;
\r
93 procedure linklist2del(var baseptr:tlinklist2;item:tlinklist2);
\r
95 if item = baseptr then baseptr := item.next2;
\r
96 if item.prev2 <> nil then item.prev2.next2 := item.next2;
\r
97 if item.next2 <> nil then item.next2.prev2 := item.prev2;
\r
102 constructor tlinklist.create;
\r
105 inc(linklistdebug);
\r
108 destructor tlinklist.destroy;
\r
110 dec(linklistdebug);
\r