}
IPath path = curResource.getFullPath();// ff.getFullPath().append(inoFile);
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
ITranslationUnit tu = (ITranslationUnit) CoreModel.getDefault().create(file);
if (tu == null) {
body += "\n";
body += "#error the file: " + curResource.getName() + " is not found in the indexer though it exists on the file system.\n";
body += "#error this is probably due to a bad eclipse configuration : ino and pde are not marked as c++ file.\n";
body += "#error please check wether *.ino and *.pde are marked as C++ source code in windows->preferences->C/C++->file types.\n";
} else {
IASTTranslationUnit asttu = tu.getAST(index, ITranslationUnit.AST_SKIP_FUNCTION_BODIES | ITranslationUnit.AST_SKIP_ALL_HEADERS);
IASTNode astNodes[] = asttu.getChildren();
for (IASTNode astNode : astNodes) {
if (astNode instanceof CPPASTFunctionDefinition) {
String addString = astNode.getRawSignature();
addString = addString.replaceAll("\r\n", "\n");
addString = addString.replaceAll("\r", "\n");
addString = addString.replaceAll("//[^\n]+\n", " ");
addString = addString.replaceAll("\n", " ");
addString = addString.replaceAll("\\{.+\\}", "");
if (addString.contains("=")) {
// ignore when there are assignements in the declaration
} else {
body += addString + ";\n";
}
}
}
IInclude includes[] = tu.getIncludes();
for (IInclude include : includes) {
includeHeaderPart += include.getSource();
includeHeaderPart += "\n";
}
}