Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compiler Tools Pccts > Beginner needs ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 106 of 134
Post > Topic >>

Beginner needs some help for c++ to c# code processing

by "Alex74" <infal@[EMAIL PROTECTED] > Aug 22, 2005 at 06:01 AM

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
 




 1 Posts in Topic:
Beginner needs some help for c++ to c# code processing
"Alex74" <in  2005-08-22 06:01:17 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 20:14:35 CDT 2008.