nim-lang / c2nim

c2nim is a tool to translate Ansi C code to Nim. The output is human-readable Nim code that is meant to be tweaked by hand before and after the translation process.
MIT License
506 stars 63 forks source link

c2nim fails on some typedefs #44

Open Peter2121 opened 9 years ago

Peter2121 commented 9 years ago

For example:

typedef LBER_INT_T ber_int_t; is correctly parsed

typedef signed LBER_INT_T ber_sint_t; Error: ';' expected

It seems that 'signed' is the cause.

Idem for: typedef int* (*BER_ERRNO_FN) LDAP_P(( void ));

ghost commented 9 years ago

Similiar problem but not typedef:

extern const uint16_t PROGMEM port_to_mode_PGM[];

Error: ';' expected

extern const uint16_t port_to_mode_PGM[];

Succeed

Araq commented 9 years ago

@t3476 PROGMEM is not C, it's vendor specific. Use #def PROGMEM to make c2nim ignore it.

bdandy commented 6 years ago

I'm having issue with processing next typedefs:

typedef struct NV_IFROGL_SESSION_HANDLE_REC
{
} *NV_IFROGL_SESSION_HANDLE;
typedef void (NVIFROGLAPI *NV_IFROGL_DEBUG_CALLBACK_PROC)(NV_IFROGL_DEBUG_SEVERITY severity, const char *message, void *userParam);
NVIFROGLSTATUS NVIFROGLAPI NvIFROGLCreateSession(NV_IFROGL_SESSION_HANDLE *pSessionHandle, const NV_IFROGL_SESSION_PARAMS *params);