-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrapping macro and conditional compilation semantics #21
Comments
Algorithm description from the IRC discussion - I think the only way to properly map conditional compilation and related logic is to try and get the proper /AST/ of the macro, or If the macro contains concatenation tokens it becomes somewhat more problematic, but those case be handled by replacing But we still to operate under the assumption that the token body forms a valid C code, which is of course not the case.
|
It is necessary to overlay conditional compilation on top of the API description. That is - CxxEntry should itself might information about conditional compilation. This would make type graph construction a lot more complex, since various groupings must be considered at once in order to deal with mutually recursive type uses wrapped in conditional compilation logic. |
C macros can do anything - create types, procs, conditionally enable parts of the code or define simple constants. All of this has to be somehow converted to nim macros if possible. Boost wave should be pretty useful for solving this problem.
Many macro definitions are relatively simple, which means there are multiple steps of different complexity:
#define GIT_CLONE_OPTIONS_VERSION 1
enum
- Automatically generate boilerplate code that makes wrappers easier to use #10#define get_field(arg) (arg)->name
macro
- need to find concrete examples of where this is done and how to meaningfully port this to nim.#define MAKE_STRUCT(name) struct name {};
. Maybe Qt macros from Qt support #25 would be a good starting point?The text was updated successfully, but these errors were encountered: