[ffigen] Support more MACROS
- Dominant language
- Dart
- Stars
- 275
- Forks
- 144
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 47
Description
We have support for macros that are direct constants:
* https://github.com/dart-lang/native/issues/534
But maybe we can do better and try to support more expressions and macros referring to macros.
* https://github.com/dart-lang/native/issues/1057#issuecomment-2031601888
> ```c
> // minwindef.h
>
> #define MAKEWORD(a, b) ((WORD)(((BYTE)(((DWORD_PTR)(a)) & 0xff)) | ((WORD)((BYTE)(((DWORD_PTR)(b)) & 0xff))) << 8))
> #define MAKELONG(a, b) ((LONG)(((WORD)(((DWORD_PTR)(a)) & 0xffff)) | ((DWORD)((WORD)(((DWORD_PTR)(b)) & 0xffff))) << 16))
> #define LOWORD(l) ((WORD)(((DWORD_PTR)(l)) & 0xffff))
> #define HIWORD(l) ((WORD)((((DWORD_PTR)(l)) >> 16) & 0xffff))
> #define LOBYTE(w) ((BYTE)(((DWORD_PTR)(w)) & 0xff))
> #define HIBYTE(w) ((BYTE)((((DWORD_PTR)(w)) >> 8) & 0xff))
> ```
Maybe @mannprerak2 can give some insight on what would or would not be possible.
We're happy to receive contributions if anyone wants to take a stab at this. Relevant code:
* pkgs/ffigen/lib/src/header_parser/sub_parsers/macro_parser.dart
Contributor guide
Assessment
This issue has not been assessed yet.