[fpc-pascal] RE: Comedi Lib Header translation, was: h2pas enum error
Schindler Karl-Michael
karl-michael.schindler at web.de
Sun May 30 12:22:06 CEST 2010
Am 20.05.2010 um 11:21 schrieb Hartmut Eilers:
>> If it is you can resolve it using the C preprocessor using a command
>> line similar to this one:
>
>> cpp --no-stdinc comedi.h > comedi.cpped.h
>
>> Afterwards try h2pas again.
>
> I tried the above mentioned fix with the following result:
>
> hartmut at canis:~/src/OpenMSR/PhysMach/comedi $ cpp --no-stdinc comedi.h
>> comedi.cpped.h
> cc1: error: unrecognized command line option "-fno-stdinc"
>
> This commandline option is not recognized by the compiler, hmmm.
Accodring to the man page of cpp there is -nostdinc. But even after trying it, the problem remains.
> Could anybody lend me a hand with the translation of the comedi header files ?
> Any hints are highly appreciated. Are there other tools I can use ?
> Hints on other
> docs / examples ?
h2pas only does the simple direct stuff.
All the rest needs manual replacement.
As much as I know unsigned corresponds to unsigned int.
static inline seems to be the problem.
Example (line 393):
static inline unsigned NI_USUAL_PFI_SELECT(unsigned pfi_channel)
{
if(pfi_channel < 10)
return 0x1 + pfi_channel;
else
return 0xb + pfi_channel;
}
unsigned int NI_USUAL_PFI_SELECT(unsigned int pfi_channel);
there are about 15 similar cases. At least this gives a start.
Maybe you need a translation of the function in the implementation section.
You may also need to add functions for the macros in /* range stuff */ and /* packs and unpacks a channel/range number */
check for " { was #define dname(params) para_def_expr } " in the resulting .pp file.
Finally, I prefer to use ctypes. So, unsigned int becomes cuint, float cfloat and so on. It makes checking easier.
Michael Schindler
More information about the fpc-pascal
mailing list