A.Eckleder@chateau.cl.sub.de / oh no,some e-mail ... by ME!!! To: GPC@HUT.FI (Gpc) ----------------------------------------------------------------------
...i've got some problem with the library file of the actual (?!?) alphaversion of gnu-pascal... obviousely there's some problem in string-management (gpc2.0 libs do well) here's some sample code:
type normstr=string[255]; {also tested with different string lengths}
function strng(z:real):normStr; {convert number to string} var s:normstr; k:byte; neg:boolean; begin k:=0; while (z<>int(z)) and (k<5) do begin z:=z*10; inc (k); end; s:='';if z<0 then neg:=true else neg:=false; z:=int(abs(z)); if z=0 then s:='0'; while z>0 do begin s:=chr(trunc(z-int(z/10)*10)+48)+s; z:=int(z/10); end; if k>0 then s:=copy(s,1,length(s)-k)+'.'+copy(s,length(s)-k+1,k); if neg then s:='-'+s; strng:=s; end;
as far as i could analyse the problem,the error occurs within the s:=chr(trunc(z-int(z/10)*10)+48)+s; expression. i know that this is not very optimized code,but it normally works fine though.
the other problem i realized with this alpha-version is that i couldn't manage to use the inline assembler. i only only got a message telling me function asm() not beeing existent.
because of this strong behavior i use the gpc2.0 compiler with the alpha- libraries...perhaps THIS is the reason why the function above doesn't work, but i am not quite sure about that...
andy
/------------------- A.ECKLEDER@CHATEAU.CL.SUB.DE --------------------\ Who is 'General Failure' - And why is he reading my harddisk ? ------------------ Andreas Eckleder@2:2480/816.32 -------------------/ ## CrossPoint v3.1 ##