static format_hexstr(str)
{
auto lens, i, b, ret;
i = 0;
lens = strlen(str);
ret = "";
while(i+2 <= lens)
{
if (' ' == ord(substr(str, i, i+1)) )
{
i = i+1;
continue;
}
b = hexval(substr(str, i, i+2));
if ('\\' == b)
{
ret = ret + char('\\')+char('\\');
}
else if (0 == b)
{
ret = ret + char('\\')+char(1);
}
else
{
ret = ret + char(b);
}
i = i+2;
}
return ret;
}
static fmtstrlen(fmtstr)
{
auto i, lens, ret;
lens = strlen(fmtstr);
i = 0;
ret = 0;
while(i<lens)
{
if ('\\' == (ord(substr(fmtstr, i, i+1))&0xff) )
{
i=i+2;
}
else
{
i=i+1;
}
ret = ret+1;
}
return ret;
}