buntatsu / cdt-proc

Eclipse CDT extension for Oracle Pro*C
Eclipse Public License 1.0
26 stars 7 forks source link

cdt-proc on c++ project #25

Open Helvinion opened 7 years ago

Helvinion commented 7 years ago

Hello,

I just installed this plugin on my eclipse CDT IDE, and it works fine. However, I am trying to combine C++ files and ProC statements, and I have problems with the ProC parser. If I call my file toto.cpp, the C++ parser is used and every ProC statement is considered as an error by eclipse. If I call it toto.pc, the ProC parser recognize every ProC statement, but I get a huge number of errors about my C++ statements. I think that's because the ProC parser derivates from the C parser, or am I wrong ?

I tried to call my file toto.pcc or toto.pcpp, and to configure these extensions as both C++ and Pro*C files in eclipse but I get the same result as before.

I also tried to clone this repo and to modify this plugin myself, but I still get a lot of errors. For example, ProCLexer extends Lexer, but eclipse keeps explaining me that Lexer is final and that I can't extend it. I guess I have a too new version of the CDT files, but even with eclipse Galileo and CDT 6.0 that are almost 8 years old, I get the same error.

I tried to copy some of the CDT files in the project and to modify them manually, but it was a failure as some overridden functions did not even exist in the mother class.

I even tried to manually modify the java bytecode in the compiled jar files to modify ProCBinding.java and ProCLanguage.java and replace C_LINKAGE_ID and C_LINKAGE by CPP_LINKAGE_ID and CPP_LINKAGE, but I could not see any change when I put them in my eclipse.

I am out of solution. Could you help me and tell me what I should do to have my Pro*C++ files parsed correctly ?

Thanks

buntatsu commented 7 years ago

Sorry for too late reply.

The modified CDT (cdt-pub) is necessary for the execution and development of cdt-proc. The binary file is located at https://github.com/buntatsu/cdt-proc/releases. (cdt_9_0_pub-1.0.zip,cdt_9_1_pub-1.0.zip,cdt_9_2_pub-1.0.zip) The source can be found at https://github.com/buntatsu/cdt.

In order to make cdt-proc compatible with C++, you should create a new ProCPPSourceParser class that inherits GNUCPPSourceParser and link it to .pcc or .pcpp. I think there are other things to do.

Is it an answer?

Helvinion commented 7 years ago

Hello back ! I have been working on other stuff these times, but I am back on this issue.

I did as you said, but indeed I have problems with GNUCPPSourceParser : the attribute nodeFactory it uses is private. I saw that you have been using a custom version of the CDT in order to compile the cdt_proc plugin, where I think you set this attribute (in GNUCSourceParser only) to protected visibility.

What should I do in order to change the visibility of the nodeFactory inside GNUCPPSourceParser ? I mean, I am a C/C++/ASM developer, not a java pro. I guess I should clone your version of the CDT, change what I want, then recompile it and change the old org.eclipse.cdt.core.source_5.11.0.201602051005.jar / org.eclipse.cdt.core_5.11.0.201602051005.jar files to the new ones. But what changes should I do (is setting this attribute to protected enough ?), furthermore, from which commit of your version of the CDT should I work ?

PS (I'm a working on the CDT 8.8.1, proc 3.3.0, on a MARS 2 eclipse instance)

Thank you very much ^^

gdsotirov commented 6 years ago

I vote for this functionality into the official version.