Open koachan opened 3 years ago
translate-c
can also handle macro's, so why not use that? Another extra benefit of trying to make it work with translate-c
is that you can add more functionally to it, which is a win-win situation.
translate-c
can also handle macro's, so why not use that? Another extra benefit of trying to make it work withtranslate-c
is that you can add more functionally to it, which is a win-win situation.
Just checked, and yep, it can handle macros, even following #include
s to do so. Deleted my original post.
So, the solution is to write a C file that loads all the constants then convert it with translate-c?
Apparently #11447 will help with generating Linux syscall constants, at least. That's pretty nice.
something akin to https://github.com/ziglang/fetch-them-macos-headers for linux would be a nice approach
Manually copying constant definitions is a very time-consuming and error-prone process. It'd be very nice if we can automate the process, somehow. This would greatly ease porting efforts to new CPU architectures, I believe.
Any ideas on how to do this? Perhaps a simple design would be having a list of per-OS constants and what C header is it defined, then we can make a small script that will pull the values for each platform it supports.
(Sparked from the discussion in this PR)