With arbitrary ";", how about a kind of the Python syntax - that's
w/o garbage "then", "do" & "end" statements ?
Currently it's emulated like :
================
function http_file_size(const http: thttpsend; const url: msestring;
var filesize: integer; var hdrsize: cardinal): treqresult;
var
i:integer;
sz:string;
ch:char;
httpresult: boolean;
retriescnt: integer;
begin
filesize:= -1;
result:= REQ_FAILED;
with http do begin
retriescnt:= 0;
clear; // на всякий случай
httpresult:= HTTPMethod('GET', url);
while (not httpresult) and (http_max_retries > retriescnt) do begin
sleep(500*retriescnt);
httpresult:= HTTPMethod('HEAD', url);
inc(retriescnt); end;
result:= HTTPReqStatus(resultcode);
if result = REQ_SUCCESS then begin
hdrsize:= Length(Headers.Text);
for i:= 0 to Headers.Count-1 do begin
if pos('content-length',lowercase(Headers[i])) > 0 then begin
sz:= '';
for ch in Headers[i] do if ch in ['0'..'9'] then
sz:= sz + ch;
filesize:= StrToInt(sz);
break; end; end; end; end; end;
==================
Well readable, isn't it ?
Note a group of "end" at the end :)
------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk