Forum > General

FPC 3.2.2 - fpc_char_to_ansistring -

(1/2) > >>

paule32:
Hi,
I am again  ;D
On my own system.pas, I get faced with this Code:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var  S1: String;  ch: Char;begin  S1 := S1 + ch;end;
and I get this message:
Error: Incompatible type for arg no. 3: Got "AnsiString", expected "Pointer"

for:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---function  fpc_char_to_ansistr (const c : Char; cp : TSystemCodePage): AnsiString; compilerproc;
I get no system error about my own system.pas - only the Error above.
Has it to do with system.pas ?
How can I fix this issue ?

Thanks for helping hands
paule32

Fibonacci:
You got 2 args in this proc, the error is probably in: fpc_ansistr_concat as its called right after.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure fpc_ansistr_concat(var dst: Pointer; const S1,S2: Pointer; cp: DWORD); compilerproc;var    S1Len, S2Len, S3Len: SIZE_T;    DestS: Pointer;begin    S1Len := strlen( S1 );    S2Len := strlen( S2 );        dst := VirtualAlloc(nil, S1Len + 1,    MEM_COMMIT or MEM_RESERVE, PAGE_READWRITE );        if not (dst = nil) then    begin        FillChar( dst, S1Len, #0 );        strcpy( dst, S1 );        strcat( dst, S2 );    end else    begin        MessageBox( 0, 'Error: fpc_AnsiStr_Concat memory allocation fail.', 'Error', 0 );        ExitProcess( 1 );    end;end;
How does my code in RTL look and it works:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure fpc_ansistr_concat(var dests: RawByteString; const s1, s2: RawByteString; cp: TSystemCodePage); compilerproc;begin  pointer(dests) := new_ansistring(length(s1)+length(s2));  move(s1[1], dests[1], length(s1));  move(s2[1], dests[length(s1)+1], length(s2));end;
You can see it at my private repo you have access to.

EDIT: Or, edit your fpc_char_to_ansistr to return Pointer, not AnsiString; BTW. it currently doesnt return anything.

paule32:
Thanks.
- Your Code and effort looks good.
- You are on the right way - some parts, I have stolen for own tests.
- You made the projects private - for a surprise :-) ?

- You take effort for x86 i386 ?
- my own takes for x86_64

it is good to hear, and see, that both ABI's are introduce.

Fibonacci:
I work on x86 (easier to debug), but the goal is to make it work on both. I have no idea if it compiles for x64. I dont see why it wouldnt.

The repo is private because Im shy :-[ I will open it to public when the time is right.

paule32:
I did start the documentation - you have see it ?
They comes in three version's - html, pdf, and chm.
And these I would provide two version's - English, and German with help of doxygen.

Doxygen is currently/mainly available for C/C++ source code documentation.
But like you can see, it can both PAS and CPP.

Navigation

[0] Message Index

[#] Next page

Go to full version