Re: [fpc-devel] Patch for bug 3774

2005-05-29 Thread Sterling Bates
In reply to Thomas Schatzl:

Another optimization for your patch is to set a var to length(s) at the beginning of the proc, and use the var instead. It's called often enough that a little time could be shaved off.Post your free ad now! Yahoo! Canada Personals___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Patch for bug 3774

2005-04-02 Thread Florian Klaempfl
Thomas Schatzl wrote:

 Sterling Bates schrieb:
 
 This patch adds recognition for hex to Val().

Applied.

What about the extended (?) pascal convention 16# ?

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] Patch for bug 3774

2005-03-30 Thread Sterling Bates
This patch adds recognition for hex to Val().

SterlingPost your free ad now! Yahoo! Canada PersonalsIndex: sstrings.inc
===
RCS file: /FPC/CVS/fpc/rtl/inc/sstrings.inc,v
retrieving revision 1.35
diff -w -b -i -u -p -1 -0 -r1.35 sstrings.inc
--- sstrings.inc20 Mar 2005 12:45:19 -  1.35
+++ sstrings.inc27 Mar 2005 05:12:42 -
@@ -552,20 +552,25 @@ begin
   '%' : begin
   base:=2;
   inc(code);
 end;
   '' : begin
   Base:=8;
   repeat
 inc(code);
   until (code=length(s)) or (s[code]'0');
 end;
+  '0' : if (code  length(s)) and (s[code+1]='x') then
+begin
+  base := 16;
+  Inc(code, 2);
+end;
  end;
   end;
   InitVal:=code;
 end;
 
 
 Function fpc_Val_SInt_ShortStr(DestSize: SizeInt; Const S: ShortString; var 
Code: ValSInt): ValSInt; [public, alias:'FPC_VAL_SINT_SHORTSTR']; {$ifdef 
hascompilerproc} compilerproc; {$endif}
 var
   u, temp, prev, maxPrevValue, maxNewValue: ValUInt;
   base : byte;
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Patch for bug 3774

2005-03-30 Thread Thomas Schatzl
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