|
@@ -50,6 +50,7 @@ unit cobjects;
|
|
fileindex : word;
|
|
fileindex : word;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+
|
|
{ some help data types }
|
|
{ some help data types }
|
|
pstringitem = ^tstringitem;
|
|
pstringitem = ^tstringitem;
|
|
tstringitem = record
|
|
tstringitem = record
|
|
@@ -73,6 +74,7 @@ unit cobjects;
|
|
destructor done;virtual;
|
|
destructor done;virtual;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+
|
|
{ this implements a double linked list }
|
|
{ this implements a double linked list }
|
|
plinkedlist = ^tlinkedlist;
|
|
plinkedlist = ^tlinkedlist;
|
|
tlinkedlist = object
|
|
tlinkedlist = object
|
|
@@ -103,6 +105,7 @@ unit cobjects;
|
|
function empty:boolean;
|
|
function empty:boolean;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+
|
|
{ String Queue}
|
|
{ String Queue}
|
|
PStringQueue=^TStringQueue;
|
|
PStringQueue=^TStringQueue;
|
|
TStringQueue=object
|
|
TStringQueue=object
|
|
@@ -116,18 +119,18 @@ unit cobjects;
|
|
procedure Clear;
|
|
procedure Clear;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+
|
|
{ string container }
|
|
{ string container }
|
|
pstringcontainer = ^tstringcontainer;
|
|
pstringcontainer = ^tstringcontainer;
|
|
tstringcontainer = object
|
|
tstringcontainer = object
|
|
- root,last : pstringitem;
|
|
|
|
-
|
|
|
|
- { if this is set to true, doubles are allowed }
|
|
|
|
- { true is default }
|
|
|
|
- doubles : boolean;
|
|
|
|
|
|
+ root,
|
|
|
|
+ last : pstringitem;
|
|
|
|
+ doubles : boolean; { if this is set to true, doubles are allowed }
|
|
constructor init;
|
|
constructor init;
|
|
|
|
+ constructor init_no_double;
|
|
destructor done;
|
|
destructor done;
|
|
|
|
|
|
- { true is the container empty }
|
|
|
|
|
|
+ { true when the container is empty }
|
|
function empty:boolean;
|
|
function empty:boolean;
|
|
|
|
|
|
{ inserts a string }
|
|
{ inserts a string }
|
|
@@ -138,11 +141,14 @@ unit cobjects;
|
|
function get : string;
|
|
function get : string;
|
|
function get_with_tokeninfo(var file_info : tfileposinfo) : string;
|
|
function get_with_tokeninfo(var file_info : tfileposinfo) : string;
|
|
|
|
|
|
|
|
+ { true if string is in the container }
|
|
function find(const s:string):boolean;
|
|
function find(const s:string):boolean;
|
|
|
|
+
|
|
{ deletes all strings }
|
|
{ deletes all strings }
|
|
procedure clear;
|
|
procedure clear;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+
|
|
{$ifdef BUFFEREDFILE}
|
|
{$ifdef BUFFEREDFILE}
|
|
{ this is implemented to allow buffered binary I/O }
|
|
{ this is implemented to allow buffered binary I/O }
|
|
pbufferedfile = ^tbufferedfile;
|
|
pbufferedfile = ^tbufferedfile;
|
|
@@ -429,32 +435,36 @@ end;
|
|
****************************************************************************}
|
|
****************************************************************************}
|
|
|
|
|
|
constructor tstringcontainer.init;
|
|
constructor tstringcontainer.init;
|
|
-
|
|
|
|
begin
|
|
begin
|
|
root:=nil;
|
|
root:=nil;
|
|
last:=nil;
|
|
last:=nil;
|
|
doubles:=true;
|
|
doubles:=true;
|
|
end;
|
|
end;
|
|
|
|
|
|
- destructor tstringcontainer.done;
|
|
|
|
|
|
|
|
|
|
+ constructor tstringcontainer.init_no_double;
|
|
begin
|
|
begin
|
|
- clear;
|
|
|
|
|
|
+ root:=nil;
|
|
|
|
+ last:=nil;
|
|
|
|
+ doubles:=false;
|
|
end;
|
|
end;
|
|
|
|
|
|
- function tstringcontainer.empty:boolean;
|
|
|
|
|
|
+
|
|
|
|
+ destructor tstringcontainer.done;
|
|
|
|
+ begin
|
|
|
|
+ clear;
|
|
|
|
+ end;
|
|
|
|
|
|
|
|
|
|
|
|
+ function tstringcontainer.empty:boolean;
|
|
begin
|
|
begin
|
|
empty:=(root=nil);
|
|
empty:=(root=nil);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure tstringcontainer.insert(const s : string);
|
|
procedure tstringcontainer.insert(const s : string);
|
|
-
|
|
|
|
var
|
|
var
|
|
- hp : pstringitem;
|
|
|
|
-
|
|
|
|
|
|
+ hp : pstringitem;
|
|
begin
|
|
begin
|
|
if not(doubles) then
|
|
if not(doubles) then
|
|
begin
|
|
begin
|
|
@@ -473,12 +483,10 @@ end;
|
|
last:=hp;
|
|
last:=hp;
|
|
end;
|
|
end;
|
|
|
|
|
|
- procedure tstringcontainer.insert_with_tokeninfo
|
|
|
|
- (const s : string; const file_info : tfileposinfo);
|
|
|
|
|
|
|
|
|
|
+ procedure tstringcontainer.insert_with_tokeninfo(const s : string; const file_info : tfileposinfo);
|
|
var
|
|
var
|
|
hp : pstringitem;
|
|
hp : pstringitem;
|
|
-
|
|
|
|
begin
|
|
begin
|
|
if not(doubles) then
|
|
if not(doubles) then
|
|
begin
|
|
begin
|
|
@@ -498,11 +506,10 @@ end;
|
|
last:=hp;
|
|
last:=hp;
|
|
end;
|
|
end;
|
|
|
|
|
|
- procedure tstringcontainer.clear;
|
|
|
|
|
|
|
|
|
|
+ procedure tstringcontainer.clear;
|
|
var
|
|
var
|
|
hp : pstringitem;
|
|
hp : pstringitem;
|
|
-
|
|
|
|
begin
|
|
begin
|
|
hp:=root;
|
|
hp:=root;
|
|
while assigned(hp) do
|
|
while assigned(hp) do
|
|
@@ -516,11 +523,10 @@ end;
|
|
root:=nil;
|
|
root:=nil;
|
|
end;
|
|
end;
|
|
|
|
|
|
- function tstringcontainer.get : string;
|
|
|
|
|
|
|
|
|
|
+ function tstringcontainer.get : string;
|
|
var
|
|
var
|
|
hp : pstringitem;
|
|
hp : pstringitem;
|
|
-
|
|
|
|
begin
|
|
begin
|
|
if root=nil then
|
|
if root=nil then
|
|
get:=''
|
|
get:=''
|
|
@@ -534,11 +540,10 @@ end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
- function tstringcontainer.get_with_tokeninfo(var file_info : tfileposinfo) : string;
|
|
|
|
|
|
|
|
|
|
+ function tstringcontainer.get_with_tokeninfo(var file_info : tfileposinfo) : string;
|
|
var
|
|
var
|
|
hp : pstringitem;
|
|
hp : pstringitem;
|
|
-
|
|
|
|
begin
|
|
begin
|
|
if root=nil then
|
|
if root=nil then
|
|
begin
|
|
begin
|
|
@@ -558,6 +563,7 @@ end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+
|
|
function tstringcontainer.find(const s:string):boolean;
|
|
function tstringcontainer.find(const s:string):boolean;
|
|
var
|
|
var
|
|
hp : pstringitem;
|
|
hp : pstringitem;
|
|
@@ -572,7 +578,6 @@ end;
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
hp:=hp^.next;
|
|
hp:=hp^.next;
|
|
-
|
|
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -582,56 +587,53 @@ end;
|
|
****************************************************************************}
|
|
****************************************************************************}
|
|
|
|
|
|
constructor tlinkedlist_item.init;
|
|
constructor tlinkedlist_item.init;
|
|
-
|
|
|
|
begin
|
|
begin
|
|
previous:=nil;
|
|
previous:=nil;
|
|
next:=nil;
|
|
next:=nil;
|
|
end;
|
|
end;
|
|
|
|
|
|
destructor tlinkedlist_item.done;
|
|
destructor tlinkedlist_item.done;
|
|
-
|
|
|
|
begin
|
|
begin
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+
|
|
{****************************************************************************
|
|
{****************************************************************************
|
|
TSTRING_ITEM
|
|
TSTRING_ITEM
|
|
****************************************************************************}
|
|
****************************************************************************}
|
|
|
|
|
|
constructor tstring_item.init(const s : string);
|
|
constructor tstring_item.init(const s : string);
|
|
-
|
|
|
|
begin
|
|
begin
|
|
str:=stringdup(s);
|
|
str:=stringdup(s);
|
|
end;
|
|
end;
|
|
|
|
|
|
- destructor tstring_item.done;
|
|
|
|
|
|
|
|
|
|
+ destructor tstring_item.done;
|
|
begin
|
|
begin
|
|
stringdispose(str);
|
|
stringdispose(str);
|
|
inherited done;
|
|
inherited done;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+
|
|
{****************************************************************************
|
|
{****************************************************************************
|
|
TLINKEDLIST
|
|
TLINKEDLIST
|
|
****************************************************************************}
|
|
****************************************************************************}
|
|
|
|
|
|
constructor tlinkedlist.init;
|
|
constructor tlinkedlist.init;
|
|
-
|
|
|
|
begin
|
|
begin
|
|
first:=nil;
|
|
first:=nil;
|
|
last:=nil;
|
|
last:=nil;
|
|
end;
|
|
end;
|
|
|
|
|
|
- destructor tlinkedlist.done;
|
|
|
|
|
|
|
|
|
|
+ destructor tlinkedlist.done;
|
|
begin
|
|
begin
|
|
clear;
|
|
clear;
|
|
end;
|
|
end;
|
|
|
|
|
|
- procedure tlinkedlist.clear;
|
|
|
|
|
|
|
|
|
|
+ procedure tlinkedlist.clear;
|
|
var
|
|
var
|
|
hp : plinkedlist_item;
|
|
hp : plinkedlist_item;
|
|
-
|
|
|
|
begin
|
|
begin
|
|
hp:=first;
|
|
hp:=first;
|
|
while assigned(hp) do
|
|
while assigned(hp) do
|
|
@@ -642,8 +644,8 @@ end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
- procedure tlinkedlist.insertlist(p : plinkedlist);
|
|
|
|
|
|
|
|
|
|
+ procedure tlinkedlist.insertlist(p : plinkedlist);
|
|
begin
|
|
begin
|
|
{ empty list ? }
|
|
{ empty list ? }
|
|
if not(assigned(p^.first)) then
|
|
if not(assigned(p^.first)) then
|
|
@@ -665,8 +667,8 @@ end;
|
|
p^.last:=nil;
|
|
p^.last:=nil;
|
|
end;
|
|
end;
|
|
|
|
|
|
- procedure tlinkedlist.concat(p : plinkedlist_item);
|
|
|
|
|
|
|
|
|
|
+ procedure tlinkedlist.concat(p : plinkedlist_item);
|
|
begin
|
|
begin
|
|
p^.previous:=nil;
|
|
p^.previous:=nil;
|
|
p^.next:=nil;
|
|
p^.next:=nil;
|
|
@@ -680,8 +682,8 @@ end;
|
|
last:=p;
|
|
last:=p;
|
|
end;
|
|
end;
|
|
|
|
|
|
- procedure tlinkedlist.insert(p : plinkedlist_item);
|
|
|
|
|
|
|
|
|
|
+ procedure tlinkedlist.insert(p : plinkedlist_item);
|
|
begin
|
|
begin
|
|
p^.previous:=nil;
|
|
p^.previous:=nil;
|
|
p^.next:=nil;
|
|
p^.next:=nil;
|
|
@@ -696,8 +698,8 @@ end;
|
|
first:=p;
|
|
first:=p;
|
|
end;
|
|
end;
|
|
|
|
|
|
- procedure tlinkedlist.remove(p : plinkedlist_item);
|
|
|
|
|
|
|
|
|
|
+ procedure tlinkedlist.remove(p : plinkedlist_item);
|
|
begin
|
|
begin
|
|
if not(assigned(p)) then
|
|
if not(assigned(p)) then
|
|
exit;
|
|
exit;
|
|
@@ -727,8 +729,8 @@ end;
|
|
p^.previous:=nil;
|
|
p^.previous:=nil;
|
|
end;
|
|
end;
|
|
|
|
|
|
- procedure tlinkedlist.concatlist(p : plinkedlist);
|
|
|
|
|
|
|
|
|
|
+ procedure tlinkedlist.concatlist(p : plinkedlist);
|
|
begin
|
|
begin
|
|
if not(assigned(p^.first)) then
|
|
if not(assigned(p^.first)) then
|
|
exit;
|
|
exit;
|
|
@@ -748,6 +750,7 @@ end;
|
|
p^.first:=nil;
|
|
p^.first:=nil;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+
|
|
function tlinkedlist.empty:boolean;
|
|
function tlinkedlist.empty:boolean;
|
|
begin
|
|
begin
|
|
empty:=(first=nil);
|
|
empty:=(first=nil);
|
|
@@ -1142,7 +1145,10 @@ end;
|
|
end.
|
|
end.
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.14 1998-09-18 16:03:37 florian
|
|
|
|
|
|
+ Revision 1.15 1998-10-19 18:04:40 peter
|
|
|
|
+ + tstringcontainer.init_no_doubles
|
|
|
|
+
|
|
|
|
+ Revision 1.14 1998/09/18 16:03:37 florian
|
|
* some changes to compile with Delphi
|
|
* some changes to compile with Delphi
|
|
|
|
|
|
Revision 1.13 1998/08/12 19:28:16 peter
|
|
Revision 1.13 1998/08/12 19:28:16 peter
|