digitalmars.D.learn - Help convert a C++ header to D
- Arialis Majoris (8/8) Jan 02 2016 I have a rather large header file used to write plugins for
- Rikki Cattermole (3/9) Jan 02 2016 It's really quite simple.
- Arialis Majoris (4/19) Jan 03 2016 If that's the case, shouldn't there be an automated utility?
- Rikki Cattermole (4/21) Jan 03 2016 htod is pretty old at this point and is Windows only.
- Arialis Majoris (4/21) Jan 03 2016 Could you explain instead of telling me that? ;) It doesn't help
- Rikki Cattermole (28/48) Jan 03 2016 The reason I didn't go into it any further is because I don't want to
I have a rather large header file used to write plugins for reaper: http://pastebin.com/Eebv1e0M This file, unfortunately may change quite often depending on the version of reaper. Reaper automatically generates the C++ file. Is there a way to automatically convert this without too much trouble? Thanks
Jan 02 2016
On 03/01/16 7:04 PM, Arialis Majoris wrote:I have a rather large header file used to write plugins for reaper: http://pastebin.com/Eebv1e0M This file, unfortunately may change quite often depending on the version of reaper. Reaper automatically generates the C++ file. Is there a way to automatically convert this without too much trouble? ThanksIt's really quite simple. You would probably only need like 2 regex's to do it.
Jan 02 2016
On Sunday, 3 January 2016 at 06:07:09 UTC, Rikki Cattermole wrote:On 03/01/16 7:04 PM, Arialis Majoris wrote: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?I have a rather large header file used to write plugins for reaper: http://pastebin.com/Eebv1e0M This file, unfortunately may change quite often depending on the version of reaper. Reaper automatically generates the C++ file. Is there a way to automatically convert this without too much trouble? ThanksIt's really quite simple. You would probably only need like 2 regex's to do it.
Jan 03 2016
On 03/01/16 9:26 PM, Arialis Majoris wrote:On Sunday, 3 January 2016 at 06:07:09 UTC, Rikki Cattermole wrote: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.On 03/01/16 7:04 PM, Arialis Majoris wrote: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?I have a rather large header file used to write plugins for reaper: http://pastebin.com/Eebv1e0M This file, unfortunately may change quite often depending on the version of reaper. Reaper automatically generates the C++ file. Is there a way to automatically convert this without too much trouble? ThanksIt's really quite simple. You would probably only need like 2 regex's to do it.
Jan 03 2016
On Sunday, 3 January 2016 at 08:29:22 UTC, Rikki Cattermole wrote:On 03/01/16 9:26 PM, Arialis Majoris wrote: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?On Sunday, 3 January 2016 at 06:07:09 UTC, Rikki Cattermole wrote: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.On 03/01/16 7:04 PM, Arialis Majoris wrote: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?[...]It's really quite simple. You would probably only need like 2 regex's to do it.
Jan 03 2016
On 04/01/16 12:42 AM, Arialis Majoris wrote:On Sunday, 3 January 2016 at 08:29:22 UTC, Rikki Cattermole wrote: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.On 03/01/16 9:26 PM, Arialis Majoris wrote: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?On Sunday, 3 January 2016 at 06:07:09 UTC, Rikki Cattermole wrote: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.On 03/01/16 7:04 PM, Arialis Majoris wrote: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?[...]It's really quite simple. You would probably only need like 2 regex's to do it.
Jan 03 2016