请问如何将下面c语言编写的程序改成delphi的代码啊
#define UINT4 unsigned long
unsigned long myipstr2long(ip_str)
char *ip_str;
{
char buf[6];
char *ptr;
int i;
int count;
UINT4 ipaddr;
int cur_byte;
ipaddr = (UINT4)0;
for(i = 0;i < 4;i++) {
ptr = buf;//共用一个地址;
count = 0;
*ptr = '\0';
while(*ip_str != '.' && *ip_str != '\0' && count < 4) {
if(!isdigit(*ip_str)) {
return((UINT4)0);
}
*ptr++ = *ip_str++;
count++;
}
if(count >= 4 || count == 0) {
return((UINT4)0);
}
*ptr = '\0';
cur_byte = atoi(buf);
if(cur_byte < 0 || cur_byte > 255) {
return((UINT4)0);
}
ip_str++;
ipaddr = (ipaddr << 8) | (UINT4)cur_byte;
}
return(ipaddr);
}