[fpc-pascal] Free Pascal bindings for EyeLink C code (with a god-cast)

2023-06-12 Thread Rafael Picanço via fpc-pascal
Hi everyone, First of all, I am sorry if this is not the best place for this interoperability issue. The problem I want to solve is how to make a Free Pascal binding for to the following piece of C code: typedef struct _CCDBS { void *userdata; char buttons[256]; void *internal; }CCDBS; ty

Re: [fpc-pascal] fpc isn't optimised for tail recursion, is it?

2023-06-12 Thread Michalis Kamburelis via fpc-pascal
Steve, If you're looking for equivalent to "return X", use "Exit" with a parameter in Pascal: "Exit(X)". It's just a shortcut for "Result := X; Exit;" Regards, Michalis pon., 12 cze 2023 o 19:57 Steve Litt via fpc-pascal napisał(a): > > Nikolay Nikolov via fpc-pascal said on Mon, 12 Jun 2023 0

Re: [fpc-pascal] fpc isn't optimised for tail recursion, is it?

2023-06-12 Thread Steve Litt via fpc-pascal
Nikolay Nikolov via fpc-pascal said on Mon, 12 Jun 2023 09:15:17 +0300 >On 6/12/23 04:44, Steve Litt via fpc-pascal wrote: [snip] >> So, subject to your guidance, I'm assuming FPC isn't optimized for >> tail recursion. Is my assumption an accurate one? > >FPC supports tail recursion optimizati

Re: [fpc-pascal] fpc isn't optimised for tail recursion, is it?

2023-06-12 Thread Steve Litt via fpc-pascal
Marco van de Voort via fpc-pascal said on Mon, 12 Jun 2023 09:12:22 +0200 >On 12-6-2023 08:15, Nikolay Nikolov via fpc-pascal wrote: > >Shouldn't the recursive call assign the result? > >> nextt(num - 1); > > >nextt:=nextt(num - 1); > > >if you don't use the result, the whole call may be optimi

Re: [fpc-pascal] fpc isn't optimised for tail recursion, is it?

2023-06-12 Thread Steve Litt via fpc-pascal
Jean SUZINEAU via fpc-pascal said on Mon, 12 Jun 2023 18:04:07 +0200 >According to you other posts, I won't be surprised that you think in a >C/C++ way. :-) Busted! I used Pascal 1984-1993, and C 1986-present with C++ (hate it) 1990-1998. So I long ago forgot the details of pascal, and program p

Re: [fpc-pascal] fpc isn't optimised for tail recursion, is it?

2023-06-12 Thread Jean SUZINEAU via fpc-pascal
According to you other posts, I won't be surprised that you think in a C/C++ way. This doesn't change anything in your last example, but particularly  : nextt := num; doesn't behave like in C : return num; In pascal I think the equivalent would be : nextt := num; exit; _

Re: [fpc-pascal] LibXML2

2023-06-12 Thread David Connolly via fpc-pascal
Many thanks. On Mon, 12 Jun 2023 at 16:37, gabor via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > Currently, libxml2 headers are outdated and partially > incorrect/incomplete. I updated the headers a couple of years ago. You > can find the patch file here: > > https://gitlab.com/freepas

Re: [fpc-pascal] LibXML2

2023-06-12 Thread gabor via fpc-pascal
Currently, libxml2 headers are outdated and partially incorrect/incomplete. I updated the headers a couple of years ago. You can find the patch file here: https://gitlab.com/freepascal.org/fpc/source/-/issues/38905 Michał. W dniu 2023-06-12 o 17:12, David Connolly via fpc-pascal pisze: Hi al

[fpc-pascal] LibXML2

2023-06-12 Thread David Connolly via fpc-pascal
Hi all, I upgraded to Debian 12 today and I've noticed some weird behaviour with libxml2. Free Pascal Compiler version 3.2.2+dfsg-20 [2023/03/30] for x86_64 program xml; uses xml2; begin end. This program compiles fine, but will not run against the updated version of libXML2. The call of xmlXP

Re: [fpc-pascal] fpc isn't optimised for tail recursion, is it?

2023-06-12 Thread Marco van de Voort via fpc-pascal
On 12-6-2023 08:15, Nikolay Nikolov via fpc-pascal wrote: Shouldn't the recursive call assign the result? nextt(num - 1); nextt:=nextt(num - 1); if you don't use the result, the whole call may be optimized away? ___ fpc-pascal maillist - fpc