Hi,
I have a bunch of C macros the operation of which I need to simulate in python. I saw some pointers to pygccxml or ctypeslib etc. Are these the ways to go ? Or is there something out there that is better ?
The C macros if and when they change, I would like the python implementation to be auto generated rather than having to make manual modifications. Hence the question.
#ifdef OS
#define NUM_FLAGS (uint16_t)(3)
#define NUM_BITS (uint16_t)(8)
#else
#define NUM_FLAGS (uint16_t)(6)
#define NUM_BITS (uint16_t)(16)
#endif
#define MAKE_SUB_FLAGS (uint16_t)((1<<NUMFLAGS) -1)
#define MAKE_TOTAL_FLAGS(x) (uint16_t)((x & MAKE_SUB_FLAGS) >> NUM_BITS)
/* #defines type 2 */
#ifdef OS
#DO_SOMETHING(X) os_specifc_process(x)
#else
#DO_SOMETHING(x)
#endif
/* #defines type 3 */
enum
{
CASE0,
CASE1,
CASE2
}
#define MY_CASE_0 ((uint16_t)CASE0)
#define MY_CASE_1 ((uint16_t)CASE1)
#define MY_CASE_2 ((uint16_t)CASE2)
/*End of file <my_c_header.h> */
Thanks M