rpms/eclipse-cdt/F-11 eclipse-cdt-libhover-oldcdt.patch, NONE, 1.1 eclipse-cdt.spec, 1.124, 1.125
Jeff Johnston
jjohnstn at fedoraproject.org
Fri Oct 2 18:58:22 UTC 2009
Author: jjohnstn
Update of /cvs/extras/rpms/eclipse-cdt/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv19993
Modified Files:
eclipse-cdt.spec
Added Files:
eclipse-cdt-libhover-oldcdt.patch
Log Message:
Scratch build to verify changes work.
eclipse-cdt-libhover-oldcdt.patch:
META-INF/MANIFEST.MF | 1
src/org/eclipse/linuxtools/cdt/libhover/LibhoverPlugin.java | 1
src/org/eclipse/linuxtools/internal/cdt/libhover/LibHover.java | 378 +++++-----
src/org/eclipse/linuxtools/internal/cdt/libhover/LibHoverLibrary.java | 10
4 files changed, 205 insertions(+), 185 deletions(-)
--- NEW FILE eclipse-cdt-libhover-oldcdt.patch ---
diff -up ./org.eclipse.linuxtools.cdt.libhover/META-INF/MANIFEST.MF.fix ./org.eclipse.linuxtools.cdt.libhover/META-INF/MANIFEST.MF
--- ./org.eclipse.linuxtools.cdt.libhover/META-INF/MANIFEST.MF.fix 2009-10-02 14:32:05.000000000 -0400
+++ ./org.eclipse.linuxtools.cdt.libhover/META-INF/MANIFEST.MF 2009-10-02 14:33:28.000000000 -0400
@@ -18,3 +18,4 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.jface.text;bundle-version="3.4.1"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.linuxtools.cdt.libhover
+Bundle-ActivationPolicy: lazy
diff -up ./org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/cdt/libhover/LibhoverPlugin.java.fix ./org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/cdt/libhover/LibhoverPlugin.java
--- ./org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/cdt/libhover/LibhoverPlugin.java.fix 2009-10-02 14:32:28.000000000 -0400
+++ ./org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/cdt/libhover/LibhoverPlugin.java 2009-10-02 14:33:28.000000000 -0400
@@ -29,6 +29,7 @@ public class LibhoverPlugin extends Abst
* The constructor
*/
public LibhoverPlugin() {
+ plugin = this;
}
/*
diff -up ./org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/internal/cdt/libhover/LibHover.java.fix ./org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/internal/cdt/libhover/LibHover.java
--- ./org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/internal/cdt/libhover/LibHover.java.fix 2009-10-02 14:32:44.000000000 -0400
+++ ./org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/internal/cdt/libhover/LibHover.java 2009-10-02 14:41:53.000000000 -0400
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006, 2007, 2008 Red Hat, Inc.
+ * Copyright (c) 2004, 2006, 2007, 2008, 2009 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -213,44 +213,44 @@ public class LibHover implements ICHelpP
return Character.isLetterOrDigit(ch) || ch == '_' || ch == ':';
}
- private class EnclosingASTNameJob extends SharedASTJob {
- private int tlength;
- private int toffset;
- private IASTName result = null;
- public EnclosingASTNameJob (ITranslationUnit t,
- int toffset, int tlength) {
- super("EnclosingASTNameJob", t); // $NON-NLS-1$
- this.toffset = toffset;
- this.tlength = tlength;
- }
- public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) {
- if (ast != null) {
- result = ast.getNodeSelector(null).findEnclosingName(toffset, tlength);
- }
- return Status.OK_STATUS;
- }
- public IASTName getASTName() {
- return result;
- }
- }
-
- public class ASTDeclarationFinderJob extends SharedASTJob {
- private IBinding binding;
- private IASTName[] decls = null;
- public ASTDeclarationFinderJob (ITranslationUnit t, IBinding binding) {
- super("ASTDeclarationFinderJob", t); // $NON-NLS-1$
- this.binding = binding;
- }
- public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) {
- if (ast != null) {
- decls = ast.getDeclarationsInAST(binding);
- }
- return Status.OK_STATUS;
- }
- public IASTName[] getDeclarations() {
- return decls;
- }
- }
+// private class EnclosingASTNameJob extends SharedASTJob {
+// private int tlength;
+// private int toffset;
+// private IASTName result = null;
+// public EnclosingASTNameJob (ITranslationUnit t,
+// int toffset, int tlength) {
+// super("EnclosingASTNameJob", t); // $NON-NLS-1$
+// this.toffset = toffset;
+// this.tlength = tlength;
+// }
+// public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) {
+// if (ast != null) {
+// result = ast.getNodeSelector(null).findEnclosingName(toffset, tlength);
+// }
+// return Status.OK_STATUS;
+// }
+// public IASTName getASTName() {
+// return result;
+// }
+// }
+
+// public class ASTDeclarationFinderJob extends SharedASTJob {
+// private IBinding binding;
+// private IASTName[] decls = null;
+// public ASTDeclarationFinderJob (ITranslationUnit t, IBinding binding) {
+// super("ASTDeclarationFinderJob", t); // $NON-NLS-1$
+// this.binding = binding;
+// }
+// public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) {
+// if (ast != null) {
+// decls = ast.getDeclarationsInAST(binding);
+// }
+// return Status.OK_STATUS;
+// }
+// public IASTName[] getDeclarations() {
+// return decls;
+// }
+// }
public IFunctionSummary getFunctionInfo(ICHelpInvocationContext context, ICHelpBook[] helpBooks, String name) {
IFunctionSummary f;
@@ -264,146 +264,146 @@ public class LibHover implements ICHelpP
ITranslationUnit t = context.getTranslationUnit();
String className = null;
- ICPPFunctionType methodType = null;
+// ICPPFunctionType methodType = null;
- if (t.isCXXLanguage()) {
- try {
- if (context instanceof IHoverHelpInvocationContext) {
- // We know the file offset of the member reference.
- IRegion region = (IRegion)((IHoverHelpInvocationContext)context).getHoverRegion();
- char[] contents = t.getCodeReader().buffer;
- int i = region.getOffset();
- // Let's figure out if it is a pointer reference or a direct reference in which case we can
- // find the variable and hence it's class.
- if (i > 2 && contents[i-1] == '>' && contents[i-2] == '-') {
- // Pointer reference
- int j = i - 3;
- int pointer = 0;
- while (j > 0 && isCPPCharacter(contents[j])) {
- pointer = j;
- --j;
- }
- if (pointer != 0) {
- offset = pointer;
- length = region.getOffset() - pointer - 2;
- isPTR = true;
- // String pointerName = new String(contents, pointer, region.getOffset() - pointer - 2);
- // System.out.println("pointer reference to " + pointerName);
- }
- } else if (i > 1 && contents[i-1] == '.') {
- int j = i - 2;
- int ref = 0;
- while (j > 0 && isCPPCharacter(contents[j])) {
- ref = j;
- --j;
- }
- if (ref != 0) {
- offset = ref;
- length = region.getOffset() - ref - 1;
- isREF = true;
- // String refName = new String(contents, ref, region.getOffset() - ref - 1);
- // System.out.println("regular reference to " + refName);
- }
- }
- final IASTName[] result= {null};
- final int toffset = offset;
- final int tlength = length;
-
- // If we have a pointer or reference variable, get its ASTName.
- if (isPTR || isREF) {
- EnclosingASTNameJob job = new EnclosingASTNameJob(t, toffset, tlength);
- job.schedule();
- try {
- job.join();
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- if (job.getResult() == Status.OK_STATUS)
- result[0] = job.getASTName();
- }
-
- // If we get the ASTName for the variable, let's find its declaration which will give us its class.
- final IASTName[][] decl = {null};
- if (result[0] != null) {
- final IBinding binding = result[0].resolveBinding();
- ASTDeclarationFinderJob job = new ASTDeclarationFinderJob(t, binding);
- job.schedule();
- try {
- job.join();
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- if (job.getResult() == Status.OK_STATUS) {
- decl[0] = job.getDeclarations();
- }
- }
-
- // Look for a simple declaration.
- IASTNode n = null;
- if (decl[0] != null && decl[0].length > 0) {
- n = decl[0][0];
- while (n != null && !(n instanceof IASTSimpleDeclaration)) {
- n = n.getParent();
- }
- }
-
- // If we have the simple declaration, get its declaration specifier which hopefully will
- // be a named type.
- if (n != null) {
- IASTSimpleDeclaration d = (IASTSimpleDeclaration)n;
- IASTDeclSpecifier s = d.getDeclSpecifier();
- if (s instanceof IASTNamedTypeSpecifier) {
- // From the named type, we can get the binding of the type name and from that,
- // its qualified name. We need a qualified name (i.e. with namespace) because our
- // repository of classes and typedefs are hashed by fully qualified names.
- IASTName astName = ((IASTNamedTypeSpecifier)s).getName();
- if (astName != null) {
- IBinding nameBinding = astName.resolveBinding();
- if (nameBinding instanceof ICPPBinding) {
- String[] qualified = ((ICPPBinding)nameBinding).getQualifiedName();
- className = qualified[0];
- for (int k = 1; k < qualified.length; ++k)
- className += "::" + qualified[k];
- } else {
- className = nameBinding.getName();
- }
- }
- }
- }
-// System.out.println("classname is " + className);
-
- // Now, let's find the declaration of the method. We need to do this because we want the specific
- // member prototype to go searching for. There could be many members called "x" which have different
- // documentation.
- if (className != null) {
- EnclosingASTNameJob job = new EnclosingASTNameJob(t, region.getOffset(), region.getLength());
- job.schedule();
- try {
- job.join();
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- if (job.getResult() == Status.OK_STATUS)
- result[0] = job.getASTName();
- }
- if (result[0] != null) {
- final IBinding binding = result[0].getBinding();
- if (binding instanceof ICPPFunction) {
- methodType = ((ICPPFunction)binding).getType();
- }
- }
- }
- } catch (IllegalArgumentException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (DOMException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
+// if (t.isCXXLanguage()) {
+// try {
+// if (context instanceof IHoverHelpInvocationContext) {
+// // We know the file offset of the member reference.
+// IRegion region = (IRegion)((IHoverHelpInvocationContext)context).getHoverRegion();
+// char[] contents = t.getCodeReader().buffer;
+// int i = region.getOffset();
+// // Let's figure out if it is a pointer reference or a direct reference in which case we can
+// // find the variable and hence it's class.
+// if (i > 2 && contents[i-1] == '>' && contents[i-2] == '-') {
+// // Pointer reference
+// int j = i - 3;
+// int pointer = 0;
+// while (j > 0 && isCPPCharacter(contents[j])) {
+// pointer = j;
+// --j;
+// }
+// if (pointer != 0) {
+// offset = pointer;
+// length = region.getOffset() - pointer - 2;
+// isPTR = true;
+// // String pointerName = new String(contents, pointer, region.getOffset() - pointer - 2);
+// // System.out.println("pointer reference to " + pointerName);
+// }
+// } else if (i > 1 && contents[i-1] == '.') {
+// int j = i - 2;
+// int ref = 0;
+// while (j > 0 && isCPPCharacter(contents[j])) {
+// ref = j;
+// --j;
+// }
+// if (ref != 0) {
+// offset = ref;
+// length = region.getOffset() - ref - 1;
+// isREF = true;
+// // String refName = new String(contents, ref, region.getOffset() - ref - 1);
+// // System.out.println("regular reference to " + refName);
+// }
+// }
+// final IASTName[] result= {null};
+// final int toffset = offset;
+// final int tlength = length;
+//
+// // If we have a pointer or reference variable, get its ASTName.
+// if (isPTR || isREF) {
+// EnclosingASTNameJob job = new EnclosingASTNameJob(t, toffset, tlength);
+// job.schedule();
+// try {
+// job.join();
+// } catch (InterruptedException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+// if (job.getResult() == Status.OK_STATUS)
+// result[0] = job.getASTName();
+// }
+//
+// // If we get the ASTName for the variable, let's find its declaration which will give us its class.
+// final IASTName[][] decl = {null};
+// if (result[0] != null) {
+// final IBinding binding = result[0].resolveBinding();
+// ASTDeclarationFinderJob job = new ASTDeclarationFinderJob(t, binding);
+// job.schedule();
+// try {
+// job.join();
+// } catch (InterruptedException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+// if (job.getResult() == Status.OK_STATUS) {
+// decl[0] = job.getDeclarations();
+// }
+// }
+//
+// // Look for a simple declaration.
+// IASTNode n = null;
+// if (decl[0] != null && decl[0].length > 0) {
+// n = decl[0][0];
+// while (n != null && !(n instanceof IASTSimpleDeclaration)) {
+// n = n.getParent();
+// }
+// }
+//
+// // If we have the simple declaration, get its declaration specifier which hopefully will
+// // be a named type.
+// if (n != null) {
+// IASTSimpleDeclaration d = (IASTSimpleDeclaration)n;
+// IASTDeclSpecifier s = d.getDeclSpecifier();
+// if (s instanceof IASTNamedTypeSpecifier) {
+// // From the named type, we can get the binding of the type name and from that,
+// // its qualified name. We need a qualified name (i.e. with namespace) because our
+// // repository of classes and typedefs are hashed by fully qualified names.
+// IASTName astName = ((IASTNamedTypeSpecifier)s).getName();
+// if (astName != null) {
+// IBinding nameBinding = astName.resolveBinding();
+// if (nameBinding instanceof ICPPBinding) {
+// String[] qualified = ((ICPPBinding)nameBinding).getQualifiedName();
+// className = qualified[0];
+// for (int k = 1; k < qualified.length; ++k)
+// className += "::" + qualified[k];
+// } else {
+// className = nameBinding.getName();
+// }
+// }
+// }
+// }
+//// System.out.println("classname is " + className);
+//
+// // Now, let's find the declaration of the method. We need to do this because we want the specific
+// // member prototype to go searching for. There could be many members called "x" which have different
+// // documentation.
+// if (className != null) {
+// EnclosingASTNameJob job = new EnclosingASTNameJob(t, region.getOffset(), region.getLength());
+// job.schedule();
+// try {
+// job.join();
+// } catch (InterruptedException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+// if (job.getResult() == Status.OK_STATUS)
+// result[0] = job.getASTName();
+// }
+// if (result[0] != null) {
+// final IBinding binding = result[0].getBinding();
+// if (binding instanceof ICPPFunction) {
+// methodType = ((ICPPFunction)binding).getType();
+// }
+// }
+// }
+// } catch (IllegalArgumentException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// } catch (DOMException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+// }
// Loop through all the documents we have and report first match.
for (int i = 0; i < helpBooks.length; ++i) {
@@ -451,7 +451,7 @@ public class LibHover implements ICHelpP
return null;
if (methodType != null) {
try {
- args = resolveArgs(info, methodType.getParameterTypes());
+ args = resolveArgs(info, methodType.getParameterTypes(), templateTypes);
returnType = methodType.getReturnType();
} catch (DOMException e) {
// TODO Auto-generated catch block
@@ -465,11 +465,11 @@ public class LibHover implements ICHelpP
MemberInfo member = info.getMember(memberName);
if (member != null) {
MemberInfo m = null;
- if (!isParmMatch(member, args)) {
+ if (!isParmMatch(member, args, templateTypes, info)) {
ArrayList<MemberInfo> members = member.getChildren();
for (int i = 0; i < members.size(); ++i) {
MemberInfo k = members.get(i);
- if (isParmMatch(k, args)) {
+ if (isParmMatch(k, args, templateTypes, info)) {
m = k;
break;
}
@@ -513,12 +513,18 @@ public class LibHover implements ICHelpP
}
- private boolean isParmMatch(MemberInfo m, String[] args) {
+ private boolean isParmMatch(MemberInfo m, String[] args, ArrayList<String> templateTypes, ClassInfo info) {
String[] memberParms = m.getParamTypes();
+ for (int i = 0; i < memberParms.length; ++i) {
+ String[] templateParms = info.getTemplateParms();
+ for (int j = 0; j < templateTypes.size(); ++j) {
+ memberParms[i] = memberParms[i].replaceAll(templateParms[j], templateTypes.get(j));
+ }
+ }
return Arrays.equals(memberParms, args);
}
- private String[] resolveArgs(ClassInfo info, IType[] parameterTypes) {
+ private String[] resolveArgs(ClassInfo info, IType[] parameterTypes, ArrayList<String> templateTypes) {
String[] templateParms = info.getTemplateParms();
String[] result = new String[parameterTypes.length];
for (int i = 0; i < parameterTypes.length; ++i) {
@@ -529,7 +535,11 @@ public class LibHover implements ICHelpP
while (index >= 0) {
// We assume no class has more than 9 template parms.
int digit = param.charAt(index + 1) - '0';
- param = param.replaceFirst(param.substring(index, index + 2), templateParms[digit]);
+ // where possible, replace template parms with real values
+ if (digit < templateTypes.size())
+ param = param.replaceFirst(param.substring(index, index + 2), templateTypes.get(digit));
+ else
+ param = param.replaceFirst(param.substring(index, index + 2), templateParms[digit]);
index = param.indexOf("#");
}
result[i] = param;
diff -up ./org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/internal/cdt/libhover/LibHoverLibrary.java.fix ./org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/internal/cdt/libhover/LibHoverLibrary.java
--- ./org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/internal/cdt/libhover/LibHoverLibrary.java.fix 2009-10-02 14:32:52.000000000 -0400
+++ ./org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/internal/cdt/libhover/LibHoverLibrary.java 2009-10-02 14:33:28.000000000 -0400
@@ -21,10 +21,12 @@ import java.net.URL;
import java.util.ArrayList;
import org.eclipse.core.filesystem.URIUtil;
+import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.linuxtools.cdt.libhover.ClassInfo;
import org.eclipse.linuxtools.cdt.libhover.FunctionInfo;
import org.eclipse.linuxtools.cdt.libhover.LibHoverInfo;
+import org.eclipse.linuxtools.cdt.libhover.LibhoverPlugin;
import org.eclipse.linuxtools.cdt.libhover.TypedefInfo;
public class LibHoverLibrary {
@@ -98,7 +100,13 @@ public class LibHoverLibrary {
URL url = acDoc.toURL();
docStream = url.openStream();
} else {
- docStream = new FileInputStream(p.toFile());
+ try {
+ // Try to open the file as local to this plug-in.
+ docStream = FileLocator.openStream(LibhoverPlugin.getDefault().getBundle(), p, false);
+ } catch (IOException e) {
+ // File is not local to plug-in, try file system.
+ docStream = new FileInputStream(p.toFile());
+ }
}
ObjectInputStream input = new ObjectInputStream(docStream);
hoverInfo = (LibHoverInfo)input.readObject();
Index: eclipse-cdt.spec
===================================================================
RCS file: /cvs/extras/rpms/eclipse-cdt/F-11/eclipse-cdt.spec,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -p -r1.124 -r1.125
--- eclipse-cdt.spec 25 Sep 2009 18:15:04 -0000 1.124
+++ eclipse-cdt.spec 2 Oct 2009 18:58:22 -0000 1.125
@@ -20,7 +20,7 @@ Epoch: 1
Summary: Eclipse C/C++ Development Tools (CDT) plugin
Name: eclipse-cdt
Version: %{majmin}.%{micro}
-Release: 5%{?dist}
+Release: 5.1%{?dist}
License: EPL and CPL
Group: Development/Tools
URL: http://www.eclipse.org/cdt
@@ -106,9 +106,10 @@ Patch17: %{name}-autotools-bug281582.pat
# plugin and not require html to access them.
Patch18: %{name}-libhover-local.patch
-# Following is a patch to libhover to fix member resolution, plugin loading,
-# and to enable local plugin file support for docs.
-Patch19: %{name}-libhover.patch
+# Following is a patch to libhover to allow libhover docs to be in the
+# libhover plugin. It also disables C++ support from 0_3_0 which requires
+# CDT 6.0.
+Patch19: %{name}-libhover-oldcdt.patch
BuildRequires: eclipse-pde
BuildRequires: eclipse-mylyn >= 3.0
@@ -594,6 +595,9 @@ fi
%endif
%changelog
+* Fri Oct 02 2009 Jeff Johnston <jjohnstn at redhat.com> 5.0.2-6
+- Disable libstdc++ libhover from 0.3.0 which cannot work without CDT 6.0.
+
* Wed Sep 23 2009 Jeff Johnston <jjohnstn at redhat.com> 5.0.2-5
- Resolves #525004
- Upgrade libhover to 0.3.0.
More information about the fedora-extras-commits
mailing list