[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [cdt-dev] Parsing C "project" outside Eclipse?
|
Hi Nicolas,
I think one path you can take is this. It's based on experimental non-API work but it may be the essence of what you need.
To index multiple files together and to be able to resolve bindings among them, I think you need to create your own index:
1) Look at the org.eclipse.cdt.internal.core.indexer.StandaloneIndexer class and the various subclasses it has. I think you can instantiate this and its helper interfaces for looking up various kinds of files and providing the scanner information. Then I think you can pass a list of file paths to #rebuild(). This seems like the way to parse and index multiple files in a "project" together, without needing an actual IProject.
2) Then I think you can use IIndex* APIs on the index created there (I haven't done this myself before, so it may take some investigation and research).
As for making this work outside Eclipse:
1) In your plug-in project that links to the org.eclipse.cdt.core and other required Eclipse plugins, make a Java main class inside it. Launch the class as a Java Application. The PDE will be able to load classes from plugins even standalone. [* but see below]
2) Then, export the whole shebang as a JAR file (File > Export > Java > Runnable JAR file). Provide the launch configuration you used for the Java Application, and select "Package required libraries into generated JAR".
3) Then you'll have a pretty huge JAR file that includes a lot of Eclipse stuff, but can be run outside Eclipse :)
[*] Note: I haven't tried anything like this, and there may be some hurdles along the way. For example, some parts of CDT may have assumptions about a workspace or workbench existing, or they may rely on the OSGi capabilities to load essential extensions, so a standalone Java application might not work. You may need to make an OSGi framework launch, which I've never played with before. But that's the best I can offer for now, in addition to what Alena and Chris have suggested :)
-- Ed
-----Original Message-----
From: Nicolas Anquetil [mailto:anquetil.nicolas@xxxxxxxxx]
Sent: Tuesday, June 22, 2010 3:45 AM
To: CDT General developers list.
Subject: [cdt-dev] Parsing C "project" outside Eclipse?
Hi,
I am really sorry to insist on this, but I cannot find my way out of it :-(
I want to use CDT parser (and indexer?) outside eclipse to take advantage of the binding facilities.
I found how to parse a single file, but I would like to parse a "project", i.e. directory and subdirectories + possibly include path.
Can anybody suggest some place where I could find code example of how to do it?
I saw a suggestion to look at RDT in PTP, but this is a large project and I could not find what I am looking for in it.
nicolas
--
Nicolas Anquetil Univ. Lille1 / INRIA-equipe RMod