python-autopxd2
python-autopxd2 copied to clipboard
It seems that autopxd occasionally can't handle characters in enum
When I execute the command: autopxd test.h
// test.h
typedef enum
{
SDL_SCANCODE_CAPSLOCK = 57,
} SDL_Scancode;
#define SDLK_SCANCODE_MASK (1<<30)
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
typedef enum
{
SDLK_z = 'z',
SDLK_CAPSLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CAPSLOCK),
} SDL_KeyCode;
an error was thrown
File "D:/msys64/ucrt64/lib/python3.11/site-packages/autopxd/writer.py", line 125, in visit_Enum
value = str(int(value, base=0) + 1)
^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 0: "'z'"
It seems that autopxd occasionally can't handle characters in enum.