Hello list,
How to do some C header files parsing and automatic code transformation.
like:
parse this header file, and generate code for this API:
int gettimeofday(struct timeval *tv, struct timezone *tz);
generated code(automatically call the API, and dump the structure
appropriately):
void dump_time(void)
{
struct timeval tv = {0};
struct timezone tz = {0};
gettimeofday(&tv, &tz);
printf("tv_sec: %d, tv_usec: %d\n", tv.tv_sec, tv.tv_usec);
printf("tz_minuteswest: %d, tz_dsttime: %d\n", tz.tz_minuteswest,
tz.tz_dsttime);
}
because I'm working on a SDK which has hundreds of API to set and get
headware states.
It'll will be very nice to write some haskell code to parse the header
files and generate C code
that can dump hardware state automatically.
BR
Ted