On 04/01/16 12:42 AM, Arialis Majoris wrote:
On Sunday, 3 January 2016 at 08:29:22 UTC, Rikki Cattermole wrote:
On 03/01/16 9:26 PM, Arialis Majoris wrote:
On Sunday, 3 January 2016 at 06:07:09 UTC, Rikki Cattermole wrote:
On 03/01/16 7:04 PM, Arialis Majoris wrote:
[...]
It's really quite simple.
You would probably only need like 2 regex's to do it.
If that's the case, shouldn't there be an automated utility? Seems like
it would be more complex? I thought there was a D tool that converted C
headers into D?
htod is pretty old at this point and is Windows only.
Most headers don't port well. This one will.
Its just so simple and constant the pattern.
Could you explain instead of telling me that? ;) It doesn't help me if I
don't know it too!
What won't convert well that I need to worry about?
The reason I didn't go into it any further is because I don't want to
(lazy).
You can safely remove the file guard #ifndef and #defines along with the
last #endif.
Replace with regex:
- class ...; with struct ...;
- typedef ... ...; with alias ... = ...;
- #if defined(REAPERAPI_WANT___mergesort) || !defined(REAPERAPI_MINIMAL)
with static if (__traits(compiles, REAPERAPI_WANT__mergesort) ||
!__traits(compiles, REAPERAPI_MINIMAL)) {
- #endif with }
- bool (*AddExtensionsMainMenu)(); with bool AddExtensionsMainMenu();
- REAPERAPI_DEF with (nothing)
-
Code like:
#ifdef REAPERAPI_DEF
#undef REAPERAPI_DEF
#endif
#ifdef REAPERAPI_IMPLEMENT
#define REAPERAPI_DEF
#else
#define REAPERAPI_DEF extern
#endif
Just remove it
You may need to be a bit carefil with those classes and changing them to
structs. Worse case scenario have it alias'd to a pointer of the struct.
Overall its hacky but between e.g. awk and sed you'll get it done.