digitalmars.D.bugs - [Issue 9285] New: dtoh
- d-bugmail puremagic.com (38/38) Jan 09 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9285
- d-bugmail puremagic.com (13/14) Jan 09 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9285
- d-bugmail puremagic.com (11/18) Jan 09 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9285
- d-bugmail puremagic.com (9/15) Jan 09 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9285
- d-bugmail puremagic.com (13/14) Jan 09 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9285
- d-bugmail puremagic.com (19/19) Jan 09 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9285
- d-bugmail puremagic.com (9/25) Jan 09 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9285
- d-bugmail puremagic.com (19/19) Jan 09 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9285
- d-bugmail puremagic.com (8/9) Jan 09 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9285
- d-bugmail puremagic.com (7/7) Jan 15 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9285
http://d.puremagic.com/issues/show_bug.cgi?id=9285 Summary: dtoh Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: andrei erdani.com PST --- Generating D files from C or C++ header files is a difficult endeavor. However, the converse process of generating C++ header files from D source files is easier to approach, and very useful. Possible uses include migrating a large C++ codebase to D in small steps without needing to deal with declaration duplication across D code and C++ legacy code. (The dmd compiler itself may use the tool.) Using D as source and translating from D to C++ gives a robust unique point of maintenance. Here are a few requirements: * dtoh takes a D file as input and generates C++ declarations for all pertinent function and class declarations in the D file. * Accepted declarations: data, functions, classes, and interfaces for all types that have a C++ correspondent. * D declarations that cannot be translated into C++ will be ignored. * In order to stay decoupled from the compiler, dtoh should generate C++ code from the JSON output of the D compiler. * For make friendliness, dtoh should overwrite its output if and only if the generated output is different from the existing output. * The generated C++ code should be human readable (nicely indented etc) and use good C++ practices (e.g. include guards etc). * C++11 generation is default, there should be an option to generate C++98. The tool would be in the tools/ repository and distributed alongside with the compiler in source and binary forms. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 09 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9285 Alex Rønne Petersen <alex lycus.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |alex lycus.org CET --- So how do you see this working overall? Generate a bunch of mangled declarations in the resulting .h and then generate some nice C++-y wrappers around them?* C++11 generation is default, there should be an option to generate C++98.Virtually every C++ compiler in existence supports C++03, so why not that? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 09 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9285 Iain Buclaw <ibuclaw ubuntu.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ibuclaw ubuntu.comSo how do you see this working overall? Generate a bunch of mangled declarations in the resulting .h and then generate some nice C++-y wrappers around them?It's true, even GCC's -std=c++98 switch is just an alias for -std=c++03 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------* C++11 generation is default, there should be an option to generate C++98.Virtually every C++ compiler in existence supports C++03, so why not that?
Jan 09 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9285 PST ---So how do you see this working overall? Generate a bunch of mangled declarations in the resulting .h and then generate some nice C++-y wrappers around them?No, just generate declarations for extern(C++) names. This is a tool for people who want to interface with C++ and know what steps to take.OK -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------* C++11 generation is default, there should be an option to generate C++98.Virtually every C++ compiler in existence supports C++03, so why not that?
Jan 09 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9285 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich gmail.com 08:58:26 PST ---* In order to stay decoupled from the compiler, dtoh should generate C++ codefrom the JSON output of the D compiler. JSON output still needs fixing, see https://github.com/D-Programming-Language/dmd/pull/1179 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 09 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9285 Adam D. Ruppe <destructionator gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |destructionator gmail.com 09:07:41 PST --- I just slapped something together very very quickly. It works for a couple simple things I've tried on linux: simple functions and interfaces. http://arsdnet.net/dcode/dtocpp.zip includes a little test program (test.c, test.cpp, and testcpp.d), a makefile for it, and of course, the main app, dtoh.d. dmd dtoh.d make The makefile will regenerate testcpp.json and run dtoh to build testcpp.h. I just realized, I guess I should add POD structs too, but I have real work to get back to now. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 09 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9285 PST ---I just slapped something together very very quickly. It works for a couple simple things I've tried on linux: simple functions and interfaces. http://arsdnet.net/dcode/dtocpp.zip includes a little test program (test.c, test.cpp, and testcpp.d), a makefile for it, and of course, the main app, dtoh.d. dmd dtoh.d make The makefile will regenerate testcpp.json and run dtoh to build testcpp.h. I just realized, I guess I should add POD structs too, but I have real work to get back to now.Great. When you'll assess your work is in reviewable form, you may want to submit it as a pull request to github.com/D-Programming-Language/tools. Once we have a good initial codebase others can work on it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 09 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9285 11:16:49 PST --- work is boring so i updated the zip instead. Hit a few problems, we'll really need to improve dmd's json output (I vote for that pull request!) to go much further than this I think. Maybe fix up forward declarations but meh. Turning import into include needs more json from dmd as well, and that's going to be nice to have for real work (though not strictly necessary... the user could always #include everything in the main file). Anyway here it is: http://arsdnet.net/dcode/dtocpp.zip Now structs are outputted too, as plain data skipping any functions (which I'm pretty sure should work anyway), and types are translated a little differently. If you write your declarations in D, whether you implement them in C++ or D doesn't matter, this is kinda cool for going both ways. But yeah I think this is about as good as we're going to get until that dmd pull request for json happens. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 09 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9285 PST ---Turning import into include needs more json from dmd as wellPlease submit to bugzilla anything you have, and fill the "depends on" field above to mark the dependency. Thanks! -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 09 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9285 10:11:18 PST --- Here's a pull request with what I wrote up last week: https://github.com/D-Programming-Language/tools/pull/39 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 15 2013