Hello,
(please, sorry for my english)
I'm absolute newbie in ANTLR/PCCTS and have some questions about
usability of ANTLR for the following task(s).
I've some really big library written in C++ and like to ****t it to C#.
I'm sure, this can't be made automatically, but I want to automate same
tasks.
1. bring together .h and .cpp files and generate appropriate C#
cl*****. Example
C++:
class D1: public B1
{
private:
void f1();
void f2();
public:
void f3();
void f4();
}
should became (in C#)
namespace LibName
{
public class D1: B1
{
private void f1(){/*source from Cpp*/}
private void f2(){/*source from Cpp*/}
public void f3(){/*source from Cpp*/}
public void f4(){/*source from Cpp*/}
}
....
}
2. If some function uses references or pointers it should be converted
to references an annotated as
comment about its original: Example
void f1(const T1& t1, T2* t2)
can became (in C#) something like
void f1(T1 t1, T2 t2)
// t1: const ref T1
// t2: ptr T2
3. Convert some common functions calls to C# Math function calls. I.e.:
abs(x) ==> Math.Abs(x)
fabs(x) ==>Math.Abs(x) /*because of overloading*/
....
cos(x) ==> Math.Cos(x)
4. Convert (very im****tant) presented Doxygen Comments to (C#)
XML-Comments. I.e.
@[EMAIL PROTECTED]
ros some comment text
to
some comment text
5. Formal conversion of properties definition. I.e.
__published:
__property TDensity Density={write=SetDensity, read=GetDensity};
should became:
public TDensity Density
{
get { return SetDensity(); }
set { SetDensity(value); } /*value is reserved word for value to set*/
}
6. Removing of "const" (correctness) because it is not sup****ted by C#
at all.
7. Converting "->" to "."
8. Converting dynamic_cast(y) to "y as x", etc.
9. Sup****t for Borland extensions and event definition and maybe
eliminate some of this. I.e.
__fastcall can be eliminated.
Replace "typedef declspec" by "event" , etc.
I would be very glad, if someone can provide some help for me.
Exceptionally for some related exaples.
Many thanks in advice for your help,
Alex


|