/[lcore]/trunk/blinklist.pas
ViewVC logotype

Contents of /trunk/blinklist.pas

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations)
Fri Mar 28 02:26:58 2008 UTC (13 years, 6 months ago) by plugwash
File size: 2889 byte(s)
initial import

1 (*
2 * beware IRC services, blinklist.pas
3 * Copyright (C) 2002 Bas Steendijk
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *)
19 unit blinklist;
20 {$ifdef fpc}
21 {$mode delphi}
22 {$endif}
23
24
25 interface
26
27 type
28 tlinklist=class(tobject)
29 next:tlinklist;
30 prev:tlinklist;
31 constructor create;
32 destructor destroy; override;
33 end;
34
35 {linklist with 2 links}
36 tlinklist2=class(tlinklist)
37 next2:tlinklist2;
38 prev2:tlinklist2;
39 end;
40
41 {linklist with one pointer}
42 tplinklist=class(tlinklist)
43 p:pointer
44 end;
45
46 tstringlinklist=class(tlinklist)
47 s:string;
48 end;
49
50 tthing=class(tlinklist)
51 name:string; {name/nick}
52 hashname:integer; {hash of name}
53 end;
54
55 {
56 adding new block to list (baseptr)
57 }
58 procedure linklistadd(var baseptr:tlinklist;newptr:tlinklist);
59 procedure linklistdel(var baseptr:tlinklist;item:tlinklist);
60
61
62 procedure linklist2add(var baseptr,newptr:tlinklist2);
63 procedure linklist2del(var baseptr:tlinklist2;item:tlinklist2);
64
65 var
66 linklistdebug:integer;
67
68 implementation
69
70 procedure linklistadd(var baseptr:tlinklist;newptr:tlinklist);
71 var
72 p:tlinklist;
73 begin
74 p := baseptr;
75 baseptr := newptr;
76 baseptr.prev := nil;
77 baseptr.next := p;
78 if p <> nil then p.prev := baseptr;
79 end;
80
81 procedure linklistdel(var baseptr:tlinklist;item:tlinklist);
82 begin
83 if item = baseptr then baseptr := item.next;
84 if item.prev <> nil then item.prev.next := item.next;
85 if item.next <> nil then item.next.prev := item.prev;
86 end;
87
88 procedure linklist2add(var baseptr,newptr:tlinklist2);
89 var
90 p:tlinklist2;
91 begin
92 p := baseptr;
93 baseptr := newptr;
94 baseptr.prev2 := nil;
95 baseptr.next2 := p;
96 if p <> nil then p.prev2 := baseptr;
97 end;
98
99 procedure linklist2del(var baseptr:tlinklist2;item:tlinklist2);
100 begin
101 if item = baseptr then baseptr := item.next2;
102 if item.prev2 <> nil then item.prev2.next2 := item.next2;
103 if item.next2 <> nil then item.next2.prev2 := item.prev2;
104 end;
105
106 constructor tlinklist.create;
107 begin
108 inherited create;
109 inc(linklistdebug);
110 end;
111
112 destructor tlinklist.destroy;
113 begin
114 dec(linklistdebug);
115 inherited destroy;
116 end;
117
118 end.

Properties

Name Value
svn:executable

No admin address has been configured">No admin address has been configured
ViewVC Help
Powered by ViewVC 1.1.26