procedure biniplist_free(var l:tbiniplist);\r
procedure biniplist_addlist(var l:tbiniplist;const l2:tbiniplist);\r
function biniplist_tostr(const l:tbiniplist):string;\r
+function isbiniplist(const l:tbiniplist):boolean;\r
\r
function htons(w:word):word;\r
function htonl(i:uint32):uint32;\r
{$endif}\r
end;\r
\r
-{------------------------------------------------------------------------------}\r
+{-----------biniplist stuff--------------------------------------------------}\r
+\r
+const\r
+ biniplist_prefix='bipl'#0;\r
+ biniplist_prefixlen=length(biniplist_prefix);\r
\r
function biniplist_new:tbiniplist;\r
begin\r
- result := '';\r
+ result := biniplist_prefix;\r
end;\r
\r
procedure biniplist_add(var l:tbiniplist;ip:tbinip);\r
\r
function biniplist_getcount(const l:tbiniplist):integer;\r
begin\r
- result := length(l) div sizeof(tbinip);\r
+ result := (length(l)-biniplist_prefixlen) div sizeof(tbinip);\r
end;\r
\r
function biniplist_get(const l:tbiniplist;index:integer):tbinip;\r
fillchar(result,sizeof(result),0);\r
exit;\r
end;\r
- move(l[index*sizeof(tbinip)+1],result,sizeof(result));\r
+ move(l[index*sizeof(tbinip)+1+biniplist_prefixlen],result,sizeof(result));\r
end;\r
\r
procedure biniplist_set(var l:tbiniplist;index:integer;ip:tbinip);\r
begin\r
uniquestring(l);\r
- move(ip,l[index*sizeof(tbinip)+1],sizeof(ip));\r
+ move(ip,l[index*sizeof(tbinip)+1+biniplist_prefixlen],sizeof(ip));\r
end;\r
\r
procedure biniplist_setcount(var l:tbiniplist;newlen:integer);\r
begin\r
- setlength(l,sizeof(tbinip)*newlen);\r
+ setlength(l,(sizeof(tbinip)*newlen)+biniplist_prefixlen);\r
end;\r
\r
procedure biniplist_free(var l:tbiniplist);\r
result := result + ')';\r
end;\r
\r
+function isbiniplist(const l:tbiniplist):boolean;\r
+var\r
+ i : integer;\r
+begin\r
+ for i := 1 to biniplist_prefixlen do begin\r
+ if biniplist_prefix[i] <> l[i] then begin\r
+ result := false;\r
+ exit;\r
+ end;\r
+ end;\r
+ result := true;\r
+end;\r
+\r
end.\r