Sterling Bates schrieb:
This patch adds recognition for hex to Val().
+ '0' : if (code < length(s)) and (s[code+1]='x') then
+ begin
+ base := 16;
+ Inc(code, 2);
+ end;
Here's a patch (Delphi also accepts uppercased X) and optimization for
the patch =) (To be applied to the same code version as your patch)
Regards,
Thomas
548,550c548
< repeat
< inc(code);
< until (code>=length(s)) or (s[code]<>'0');
---
> inc(code);
554c552
< inc(code);
---
> inc(code);
558,560c556,563
< repeat
< inc(code);
< until (code>=length(s)) or (s[code]<>'0');
---
> inc(code);
> end;
> '0' : begin
> if (code < length(s)) and (s[code+1] in ['x', 'X']) then
> begin
> inc(code, 2);
> base := 16;
> end;
562a566,569
> end;
> { strip leading zeros }
> while ((code < length(s)) and (s[code] = '0')) do begin
> inc(code);
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel