while this is really just a string, on the interface side it must be treated\r
as an opaque var which is passed as "var" when it needs to be modified}\r
\r
- tbiniplist=tipstring;\r
+ tbiniplist=tbufferstring;\r
\r
function biniplist_new:tbiniplist;\r
procedure biniplist_add(var l:tbiniplist;ip:tbinip);\r
procedure biniplist_setcount(var l:tbiniplist;newlen:integer);\r
procedure biniplist_free(var l:tbiniplist);\r
procedure biniplist_addlist(var l:tbiniplist;const l2:tbiniplist);\r
-function biniplist_tostr(const l:tbiniplist):tipstring;\r
+function biniplist_tostr(const l:tbiniplist):thostname;\r
function isbiniplist(const l:tbiniplist):boolean;\r
\r
function htons(w:word):word;\r
function htonl(i:uint32):uint32;\r
\r
-function ipstrtobin(const s:tipstring;var binip:tbinip):boolean;\r
-function ipstrtobinf(const s:tipstring):tbinip;\r
-function ipbintostr(const binip:tbinip):tipstring;\r
+function ipstrtobin(const s:thostname;var binip:tbinip):boolean;\r
+function ipstrtobinf(const s:thostname):tbinip;\r
+function ipbintostr(const binip:tbinip):thostname;\r
{$ifdef ipv6}\r
-function ip6bintostr(const bin:tin6_addr):tipstring;\r
-function ip6strtobin(const s:tipstring;var bin:tin6_addr):boolean;\r
+function ip6bintostr(const bin:tin6_addr):thostname;\r
+function ip6strtobin(const s:thostname;var bin:tin6_addr):boolean;\r
{$endif}\r
\r
function comparebinip(const ip1,ip2:tbinip):boolean;\r
procedure addipsoffamily(var l:tbiniplist;const l2:tbiniplist;family:integer);\r
\r
{deprecated}\r
-function longip(s:tipstring):longint;\r
+function longip(s:thostname):longint;\r
\r
function needconverttov4(const ip:tbinip):boolean;\r
procedure converttov4(var ip:tbinip);\r
\r
{internal}\r
{converts dotted v4 IP to longint. returns host endian order}\r
-function longip(s:tipstring):longint;\r
+function longip(s:thostname):longint;\r
var\r
l:longint;\r
a,b:integer;\r
ipstrtobin(s,result);\r
end;\r
\r
-function ipstrtobin(const s:tipstring;var binip:tbinip):boolean;\r
+function ipstrtobin(const s:thostname;var binip:tbinip):boolean;\r
begin\r
binip.family := 0;\r
result := false;\r
end;\r
end;\r
\r
-function ipbintostr(const binip:tbinip):tipstring;\r
+function ipbintostr(const binip:tbinip):thostname;\r
var\r
a:integer;\r
begin\r
{fpc has hostaddrtostr6 and strtohostaddr6 but the later isnt implemented yet}\r
\r
\r
-function ip6bintostr(const bin:tin6_addr):tipstring;\r
+function ip6bintostr(const bin:tin6_addr):thostname;\r
{base16 with lowercase output}\r
function makehex(w:word):ansistring;\r
begin\r
end;\r
end;\r
\r
-function ip6strtobin(const s:tipstring;var bin:tin6_addr):boolean;\r
+function ip6strtobin(const s:thostname;var bin:tin6_addr):boolean;\r
var\r
a,b:integer;\r
fields:array[0..7] of ansistring;\r
l := l + copy(l2,biniplist_prefixlen+1,maxlongint);\r
end;\r
\r
-function biniplist_tostr(const l:tbiniplist):tipstring;\r
+function biniplist_tostr(const l:tbiniplist):thostname;\r
var\r
a:integer;\r
begin\r
\r
var\r
timezone:integer;\r
- timezonestr:ansistring;\r
+ timezonestr:string;\r
irctime,unixtime:integer;\r
tickcount:integer;\r
settimebias:integer;\r
procedure timehandler;\r
procedure init;\r
\r
-function timestring(i:integer):ansistring;\r
-function timestrshort(i:integer):ansistring;\r
+function timestring(i:integer):string;\r
+function timestrshort(i:integer):string;\r
\r
{$ifdef win32}\r
function unixtimefloat_systemtime:float;\r
\r
if timezone >= 0 then timezonestr := '+' else timezonestr := '-';\r
l := abs(timezone) div 60;\r
- timezonestr := timezonestr + ansichar(l div 600 mod 10+48)+ansichar(l div 60 mod 10+48)+':'+ansichar(l div 10 mod 6+48)+ansichar(l mod 10+48);\r
+ timezonestr := timezonestr + char(l div 600 mod 10+48)+char(l div 60 mod 10+48)+':'+char(l div 10 mod 6+48)+char(l mod 10+48);\r
end;\r
\r
-function timestrshort(i:integer):ansistring;\r
+function timestrshort(i:integer):string;\r
const\r
- weekday:array[0..6] of ansistring =('Thu','Fri','Sat','Sun','Mon','Tue','Wed');\r
- month:array[0..11] of ansistring =('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');\r
+ weekday:array[0..6] of string[4]=('Thu','Fri','Sat','Sun','Mon','Tue','Wed');\r
+ month:array[0..11] of string[4]=('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');\r
var\r
y,m,d,h,min,sec,ms:word;\r
t:tdatetime;\r
inttostr(y);\r
end;\r
\r
-function timestring(i:integer):ansistring;\r
+function timestring(i:integer):string;\r
const\r
- weekday:array[0..6] of ansistring =('Thursday','Friday','Saturday','Sunday','Monday','Tuesday','Wednesday');\r
- month:array[0..11] of ansistring =('January','February','March','April','May','June','July','August','September','October','November','December');\r
+ weekday:array[0..6] of string[10]=('Thursday','Friday','Saturday','Sunday','Monday','Tuesday','Wednesday');\r
+ month:array[0..11] of string[10]=('January','February','March','April','May','June','July','August','September','October','November','December');\r
var\r
y,m,d,h,min,sec,ms:word;\r
t:tdatetime;\r
{$endif}\r
paddrint=^taddrint;\r
\r
+ { string type for storing hostnames or IP addresses as strings }\r
thostname = ansistring;\r
+ { string type for storing data (bytes) }\r
tbufferstring = ansistring;\r
- tipstring = ansistring;\r
\r
implementation\r
end.\r
sourcestream:tstream;\r
destroysourcestream:boolean;\r
constructor create(asourcestream: tstream; adestroysourcestream:boolean);\r
- constructor createf(filename : ansistring);\r
+ constructor createf(filename : string);\r
\r
function readline:ansistring;\r
function eof:boolean;\r
destroysourcestream := false;\r
end;\r
\r
-constructor treadtxt.createf(filename : ansistring);\r
+constructor treadtxt.createf(filename: string);\r
begin\r
create(tfilestream.create(filename,fmOpenRead),true);\r
end;\r