Prof A Olowofoyeku (The African Chief) wrote:
On 9 Mar 2005 at 4:50, Frank Heckenbach wrote:
[...]
The trouble with C to pascal parsing is that everybody tries to go for the silver bullet of 100% automatic conversion. They all fail, and nobody is interested long enough to try a second approach, something what is more a construction kit for converting headers or so, or a scriptable or assisted system.
This was my experience in porting the old gcc winapi headers to GPC (a few years ago). Dr Bob's "headconv" program gave me a good head start, but I also had to write a program to process the headconv output and clean it up a bit, after which I had to do some manual editing. It was a long, tedious process, but it did enable me to create a functional "Windows" unit.
It is clear that 100% conversion will not be possible for many C headers, and so another approach is needed (the compiler being able to compile C code? after all, we are already compiling assembler ...).
Best regards, The Chief
Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.greatchief.plus.com/
I'm glad the GPC and FPC developers are communicating to again provide the world with a robust Pascal programming platform.
There are differences in the languages already, that should be pointed out. For example, GPC uses "OpenHandle()" to apply the c-lib function "open()". But FPC uses "fdOpen()". Some of the parameters for read and write differ as well. "File handles" or "file descriptors" is "six of one, half-dozen of the other". These differences will simply take time. The beauty is that accessing c-libs works so well.
If I may, I encourage GPC installation on linux in a user directory, as the GPC docs suggest. This is a nice feature of GPC, no system directories are touched. Further, I suggest setting up a shell variable;
----------- gpcc='/home/user/../bin/gpc --command-line-options-... ...--unit-path=/home/user/.....' export gpcc -----------
Then, from any working directory at the prompt you just type;
$gpcc program.pas
Thanks for the fun :-)