lhamot / cpp2d Goto Github PK
View Code? Open in Web Editor NEW(Clang based) C++ to D language converter
License: Boost Software License 1.0
(Clang based) C++ to D language converter
License: Boost Software License 1.0
Have a printing policy inside the class DPrinter, rather than creating a new each time it is needed.
This kind of code doesn't work
C-style typedef enum {} toto;
enum {} toto;
int(X)
is converted to int(X)
but it has to be converted to cast(int)X
Surely, this won't be difficult, if this program actually works well. Just have it convert it's own sources to D, and upload the output on another repository.
Hi, great project you have here. I'v read that one of your missing features is the const ref problem:
Hard because, unlike in C++, in D we can't pass a rvalue to a const ref parameter
That is sadly true and the current built-in solution (auto ref
) only works in combination with templates and leads to template bloat, but there is a cheap-trick to solve this issue, maybe it'll help you out:
struct A
{
private A* self = null;
public string name = null;
this(string name)
{
this.name = name;
}
@nogc
ref A asRef()
{
this.self = &this;
return *this.self;
}
}
void test(ref A a1, ref const A a2)
{
assert(a1.name == "foo");
assert(a2.name == "bar");
}
void main()
{
test(A("foo").asRef, A("bar").asRef);
}
The objective is mainly to convert code calling third-party libraries (espacialy stdlib)
The cpp_std.d is to give some features that exist in C++ but are not in D (like red-black-tree associative array), in order to help the convertion of C++ source code.
The cpp_std project will probably grow up, and it will be better to put it in an other standalone project, downloadable with dub.
Add an option in order to choose if an object become a struct or a class
Default is:
For now, we can force an object to struct or class, but this is done in the main DPrint file.
It would be better to do it in an external cpp file, easier to extand.
The best is to put it in an external json file.
I removed const porting because D containers seams to not be const correct.
bool opEquals(Object o)
Handle LINE in and outside of macro and #LINE and ##LINE (and FILE)
Trying to build as
cmake -DCMAKE_PREFIX_PATH=/usr/lib/llvm-10/include .
make
errors as
/home/per/Work/cpp2d/CPP2D/CPP2DPPHandling.h:30:7: error: ‘void CPP2DPPHandling::InclusionDirective(clang::SourceLocation, const clang::Token&, llvm::StringRef, bool, clang::CharSourceRange, const clang::FileEntry*, llvm::StringRef, llvm::StringRef, const clang::Module*)’ marked ‘override’, but does not override
...
on Ubuntu 20.04 with libclang-10-dev
installed.
Is this because the Clang API has changed from version 6 to version 10?
A class inheriting from a noncopyable class is noncopyable, then no error message is expected.
LLVM is a gigantic dependency, and it would be really nice if I didn't have to build this myself to try it out.
There are plenty of CI services that will automate builds and release.
For the moment, all header files which have the same name as the cpp are merged with it.
Add an option to set the name(s) of headers which have to be merged with the cpp.
Rational a = { 2, 1 };
Make the UT framework more extensible.
For now, 3 files have to be changed to ad a test case.
Find a way to add just one file for new test suite, and to modify just one file for add test case.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.