Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-30 Thread el es
On 28/08/17 03:12, Paulo Costa wrote: > On 27-Aug-17 23:47, Dmitry Boyarintsev wrote: >> Is 2 neither true, nor false? 3? 4? >> >> If false is zero, >> Then true is not false. >> >> Also C doesn't have a boolean type per se. Iirc it was introduced in some >> version of c++ standard. >> >> In C it'

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-27 Thread noreply
On 2017-08-27 21:12, Paulo Costa wrote: On 27-Aug-17 23:47, Dmitry Boyarintsev wrote: Is 2 neither true, nor false? 3? 4? If false is zero, Then true is not false. Also C doesn't have a boolean type per se. Iirc it was introduced in some version of c++ standard. In C it's very strange to se

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-27 Thread Paulo Costa
On 27-Aug-17 23:47, Dmitry Boyarintsev wrote: Is 2 neither true, nor false? 3? 4? If false is zero, Then true is not false. Also C doesn't have a boolean type per se. Iirc it was introduced in some version of c++ standard. In C it's very strange to see code like that: If (b==1) It's always

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-27 Thread Dmitry Boyarintsev
Is 2 neither true, nor false? 3? 4? If false is zero, Then true is not false. Also C doesn't have a boolean type per se. Iirc it was introduced in some version of c++ standard. In C it's very strange to see code like that: If (b==1) It's always If (b) Or If (!b) On Sunday, August 27, 2017,

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-27 Thread noreply
On 2017-08-27 06:22, Dmitry Boyarintsev wrote: On Sun, Aug 27, 2017 at 2:37 AM, wrote: Why borland chose the bool to not be 100 percent compatible, and only 50 percent compatible? Bool in delphi: true = -1 Bool in C: true = ($) 1 Why not just make it exactly compatible, there m

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-27 Thread noreply
On 2017-08-27 12:25, mar...@stack.nl wrote: In our previous episode, nore...@z505.com said: > rarer > cases) That's good news, does Delphi need to add a boolean8/16/32 some day, or already has? I don't know. FPC needed it for GTK interfacing, but FPC doesn't use it. The main headers inte

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-27 Thread Sven Barth via fpc-pascal
On 27.08.2017 19:27, Marco van de Voort wrote: > In our previous episode, Sven Barth via fpc-pascal said: >> Am 27.08.2017 00:10 schrieb "Marco van de Voort" : >>> The GTK headers also use a 0/1 boolean, and for that the boolean8/16/32 >>> types were created. I couldn't quickly find docs, so I file

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-27 Thread Marco van de Voort
In our previous episode, Sven Barth via fpc-pascal said: > Am 27.08.2017 00:10 schrieb "Marco van de Voort" : > > The GTK headers also use a 0/1 boolean, and for that the boolean8/16/32 > > types were created. I couldn't quickly find docs, so I filed a bug for > that. > > Please note that there is

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-27 Thread Marco van de Voort
In our previous episode, nore...@z505.com said: > > rarer > > cases) > > That's good news, does Delphi need to add a boolean8/16/32 some day, or > already has? I don't know. FPC needed it for GTK interfacing, but FPC doesn't use it. The main headers interfaced by Delphi are WINAPI, and they hav

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-27 Thread Marco van de Voort
In our previous episode, nore...@z505.com said: > > And sometimes API don't adhere to above statement, and then having > > chosen > > the right boolean type (longbool or boolean) saves a lot of trouble. > > Another option is to write BOOLEAN wrappers around the lower level > functions that inter

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-27 Thread Dmitry Boyarintsev
On Sun, Aug 27, 2017 at 2:37 AM, wrote: > > Why borland chose the bool to not be 100 percent compatible, and only 50 > percent compatible? > > Bool in delphi: > true = -1 > > Bool in C: > true = ($) 1 > > Why not just make it exactly compatible, there must be some underlying > (possi

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-27 Thread Sven Barth via fpc-pascal
Am 27.08.2017 00:10 schrieb "Marco van de Voort" : > The GTK headers also use a 0/1 boolean, and for that the boolean8/16/32 > types were created. I couldn't quickly find docs, so I filed a bug for that. Please note that there is no Boolean8 as that one is simply Boolean. But there is also a Boole

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-26 Thread noreply
On 2017-08-26 17:09, mar...@stack.nl wrote: In our previous episode, nore...@z505.com said: But it gets worse than that: even fpc/delphi's bool is not always compatible (but is sometimes). For example: http://blog.delphi-jedi.net/2008/09/25/bool-boolean-and-integer/ When one must use Integers

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-26 Thread noreply
On 2017-08-26 17:22, mar...@stack.nl wrote: In our previous episode, Michael Van Canneyt said: I think the programmer *must* worry about the details and must definitely NOT use the booleans for anything C related. That was my point. The interface uses bool, either as param or in a structure.

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-26 Thread noreply
On 2017-08-26 02:50, Michael Van Canneyt wrote: I thought all this BOOL mess was just meant to be able to interface with C libs slightly easier. But, why is the BOOL in fpc/delphi not compatible with C BOOL, in that it has different semantics? One value lines up correct... but not always th

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-26 Thread Marco van de Voort
In our previous episode, Michael Van Canneyt said: > I think the programmer *must* worry about the details and must definitely > NOT use the booleans for anything C related. That was my point. The interface uses bool, either as param or in a structure. So what can you do? > Attempting to cater f

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-26 Thread Marco van de Voort
In our previous episode, nore...@z505.com said: > But it gets worse than that: even fpc/delphi's bool is not always > compatible (but is sometimes). > > For example: > http://blog.delphi-jedi.net/2008/09/25/bool-boolean-and-integer/ > > When one must use Integers to do boolean related programmin

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-26 Thread Sven Barth via fpc-pascal
On 26.08.2017 13:43, Michael Van Canneyt wrote: > > > On Sat, 26 Aug 2017, Sven Barth via fpc-pascal wrote: > >>> >>> I did read it. >>> >>> I think the programmer *must* worry about the details and must >>> definitely >>> NOT use the booleans for anything C related. That was my point. >>> >>> A

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-26 Thread Michael Van Canneyt
On Sat, 26 Aug 2017, Sven Barth via fpc-pascal wrote: I did read it. I think the programmer *must* worry about the details and must definitely NOT use the booleans for anything C related. That was my point. Attempting to cater for C code using BOOL or whatever type is misplaced. C does not

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-26 Thread Sven Barth via fpc-pascal
On 26.08.2017 12:57, Michael Van Canneyt wrote: > > > On Sat, 26 Aug 2017, Sven Barth wrote: > >>> >>> Sorry for being naive. Why not simply use a boolean ? >>> >>> I thought all this BOOL mess was just meant to be able to interface >>> with C >>> libs slightly easier. >>> >>> Instead of >>> >>>

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-26 Thread Michael Van Canneyt
On Sat, 26 Aug 2017, Sven Barth wrote: Sorry for being naive. Why not simply use a boolean ? I thought all this BOOL mess was just meant to be able to interface with C libs slightly easier. Instead of If (SomeCfunction()<>0) then DoSomethingStupid; it allows you to write - in appropriat

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-26 Thread Sven Barth via fpc-pascal
Am 26.08.2017 09:50 schrieb "Michael Van Canneyt" : > > > > On Sat, 26 Aug 2017, Sven Barth via fpc-pascal wrote: > >> Am 26.08.2017 07:25 schrieb : >>> >>> >>> What about the BOOL issue.. >>> >>> We know that Boolean in fpc/delphi is not compatible with a C bool >>> >>> But it gets worse than that

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-26 Thread Michael Van Canneyt
On Sat, 26 Aug 2017, Sven Barth via fpc-pascal wrote: Am 26.08.2017 07:25 schrieb : What about the BOOL issue.. We know that Boolean in fpc/delphi is not compatible with a C bool But it gets worse than that: even fpc/delphi's bool is not always compatible (but is sometimes). For example

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-26 Thread Sven Barth via fpc-pascal
Am 26.08.2017 07:25 schrieb : > > What about the BOOL issue.. > > We know that Boolean in fpc/delphi is not compatible with a C bool > > But it gets worse than that: even fpc/delphi's bool is not always compatible (but is sometimes). > > For example: > http://blog.delphi-jedi.net/2008/09/25/bool-bo

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-25 Thread noreply
What about the BOOL issue.. We know that Boolean in fpc/delphi is not compatible with a C bool But it gets worse than that: even fpc/delphi's bool is not always compatible (but is sometimes). For example: http://blog.delphi-jedi.net/2008/09/25/bool-boolean-and-integer/ When one must use Inte

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-24 Thread Martok
> It is perfectly predictable. Just do not store invalid values in enumeration > variables. And invalid > is everything not being declared. This is how FPC works and will work. Aye. The point being, if the store operation is in a library (a getter, such as mpfr_get_default_rounding_mode), there is

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-23 Thread Dmitry Boyarintsev
On Wed, Aug 23, 2017 at 3:50 AM, Florian Klämpfl wrote: > Am 22.08.2017 um 15:59 schrieb Martok: > > As a heads-up: whatever tool you end up using, make sure you do NOT > translate > > the C enums in mpfr.h as enumerations. It will work, but create > unpredictable > > codegen on the FPC side. > >

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-23 Thread Florian Klämpfl
Am 22.08.2017 um 15:59 schrieb Martok: > If your header looks enough like IDL (which is essentially C++ with > annotations), you may also be able to use one of the available IDL compilers. > There are a few dialect issues though, so YMMV. I'd say MPFR has a few defines > too many for my idlproc (ht

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-23 Thread Martok
If your header looks enough like IDL (which is essentially C++ with annotations), you may also be able to use one of the available IDL compilers. There are a few dialect issues though, so YMMV. I'd say MPFR has a few defines too many for my idlproc (https://github.com/martok/idlproc), but may come

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-23 Thread LacaK
I'm using Chelper. (http://wiki.freepascal.org/Chelper) It's my choice, because it preserves comments (which is usually an important part of open-source libs) plus, can be configured to handle library header-specific defines. Naturally, the process is semi-automatic, but get be done quite quick

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-22 Thread noreply
On 2017-08-22 04:04, mar...@stack.nl wrote: In our previous episode, Dmitry Boyarintsev said: I'm using Chelper. (http://wiki.freepascal.org/Chelper) It's my choice, because it preserves comments (which is usually an important part of open-source libs) plus, can be configured to handle library

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-22 Thread noreply
On 2017-08-21 13:08, mar...@stack.nl wrote: In our previous episode, Michael Van Canneyt said: > I am looking to convert the GNU MPFR library header files, or hire > someone on a bounty to do it if header translation is not so easy with > h2pas and requires lots of hand work, and close checking.

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-22 Thread Marco van de Voort
In our previous episode, Dmitry Boyarintsev said: > > I'm using Chelper. (http://wiki.freepascal.org/Chelper) > It's my choice, because it preserves comments (which is usually an > important part of open-source libs) > plus, can be configured to handle library header-specific defines. > Naturally

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-21 Thread noreply
On 2017-08-21 20:34, Dmitry Boyarintsev wrote: On Sun, Aug 20, 2017 at 5:37 PM, wrote: Is there a competing tool that does more, or is updated more? How about this list? http://wiki.freepascal.org/C_to_Pascal That's a good one, I missed that.. could not find it previously when searching g

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-21 Thread Dmitry Boyarintsev
On Sun, Aug 20, 2017 at 5:37 PM, wrote: > > Is there a competing tool that does more, or is updated more? > How about this list? http://wiki.freepascal.org/C_to_Pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-21 Thread Dmitry Boyarintsev
On Sun, Aug 20, 2017 at 5:37 PM, wrote: > Is h2pas for example the one that is used for Mysql header translations > and other major C headers? > I'm using Chelper. (http://wiki.freepascal.org/Chelper) It's my choice, because it preserves comments (which is usually an important part of open-sour

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-21 Thread Marco van de Voort
In our previous episode, Michael Van Canneyt said: > > I am looking to convert the GNU MPFR library header files, or hire > > someone on a bounty to do it if header translation is not so easy with > > h2pas and requires lots of hand work, and close checking. > > I do all header translations with

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-20 Thread Michael Van Canneyt
On Sun, 20 Aug 2017, nore...@z505.com wrote: Forgive me, I have forgotten, this may have been discussed before.. Is h2pas the latest tool to convert C headers to pas files? For FPC, yes. Is there a competing tool that does more, or is updated more? I remember Bob Swart AFAIR had a popul

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-20 Thread Graeme Geldenhuys
On 2017-08-20 22:37, nore...@z505.com wrote: Is there a competing tool that does more, or is updated more? Recently somebody told me about the following project... https://github.com/DrDiettrich/CtoPas/ It's specific to Delphi I think. I haven't tried it or looked at the code, so can't say