2 * beware IRC services, blinklist.pas
\r
3 * Copyright (C) 2002 Bas Steendijk
\r
5 * This program is free software; you can redistribute it and/or modify
\r
6 * it under the terms of the GNU General Public License as published by
\r
7 * the Free Software Foundation; either version 2 of the License, or
\r
8 * (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
28 tlinklist=class(tobject)
\r
32 destructor destroy; override;
\r
35 {linklist with 2 links}
\r
36 tlinklist2=class(tlinklist)
\r
41 {linklist with one pointer}
\r
42 tplinklist=class(tlinklist)
\r
46 tstringlinklist=class(tlinklist)
\r
50 tthing=class(tlinklist)
\r
51 name:string; {name/nick}
\r
52 hashname:integer; {hash of name}
\r
56 adding new block to list (baseptr)
\r
58 procedure linklistadd(var baseptr:tlinklist;newptr:tlinklist);
\r
59 procedure linklistdel(var baseptr:tlinklist;item:tlinklist);
\r
62 procedure linklist2add(var baseptr,newptr:tlinklist2);
\r
63 procedure linklist2del(var baseptr:tlinklist2;item:tlinklist2);
\r
66 linklistdebug:integer;
\r
70 procedure linklistadd(var baseptr:tlinklist;newptr:tlinklist);
\r
76 baseptr.prev := nil;
\r
78 if p <> nil then p.prev := baseptr;
\r
81 procedure linklistdel(var baseptr:tlinklist;item:tlinklist);
\r
83 if item = baseptr then baseptr := item.next;
\r
84 if item.prev <> nil then item.prev.next := item.next;
\r
85 if item.next <> nil then item.next.prev := item.prev;
\r
88 procedure linklist2add(var baseptr,newptr:tlinklist2);
\r
94 baseptr.prev2 := nil;
\r
96 if p <> nil then p.prev2 := baseptr;
\r
99 procedure linklist2del(var baseptr:tlinklist2;item:tlinklist2);
\r
101 if item = baseptr then baseptr := item.next2;
\r
102 if item.prev2 <> nil then item.prev2.next2 := item.next2;
\r
103 if item.next2 <> nil then item.next2.prev2 := item.prev2;
\r
106 constructor tlinklist.create;
\r
109 inc(linklistdebug);
\r
112 destructor tlinklist.destroy;
\r
114 dec(linklistdebug);
\r