how to integrate the preprocesser function of cdt into jdt [message #188624] |
Mon, 06 December 2004 07:29 |
Eclipse User |
|
|
|
Originally posted by: jimisong.hotmail.com
Hi:
During my programming work, I always meet such a problem:
the original source code includes two parts:
1) one is c/c++ preprocessor macro, #define, #if, #else etc.
2) the rest is pure java code
I always use "bcc32.exe"--a preprocesser tool of Borland Corporation to
process the original source code, so that I get different versions of pure
java source code according to different preprocessor macro variables
Fox example:
--------------------------
/**
*the original source code
*/
#define ENGLISH 1
#define FRENCH 2
#define LANGUAGE ENGLISH
public class Test
{
public static void main(String args[])
{
String currentLanguage = "";
#if LANGUAGE == ENGLISH
currentLanguage = "English";
#elif LANGUAGE == FRENCH
currentLanguage = "French";
#endif
System.out.println("current language is " + currentLanguage);
}
public Test()
{
}
}
--------------------------
/**
*after "bcc32.exe"'s process in the case of #define LANGUAGE ENGLISH
*the source code should be pure java source code:
*/
public class Test
{
public static void main(String args[])
{
String currentLanguage = "";
currentLanguage = "English";
System.out.println("current language is " + currentLanguage);
}
public Test()
{
}
}
------------------------
so I want to make a special java code editor, which can recognize c/c++
preprocessor macro signal.
By far, I have studied the source code of CEditor.java in
org.eclipse.cdt.internal.ui.editor and JavaEditor.java in
org.eclipse.jdt.internal.ui.javaeditor and so on, but find little clue, I
don't know what should I study in order to create such a code editor, so
pls give me some advices, that I can begin the first step. thanks!
|
|
|
Powered by
FUDForum. Page generated in 0.02564 seconds