1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Merge remote-tracking branch 'cdt/master' into sd90

This commit is contained in:
Andrew Gvozdev 2012-03-18 07:34:11 -04:00
commit eeee4f767a
15 changed files with 197 additions and 198 deletions

View file

@ -248,7 +248,7 @@
category="org.eclipse.cdt.ui.preferences.CPluginPreferencePage" category="org.eclipse.cdt.ui.preferences.CPluginPreferencePage"
class="org.eclipse.cdt.internal.autotools.ui.preferences.AutotoolsPreferencePage" class="org.eclipse.cdt.internal.autotools.ui.preferences.AutotoolsPreferencePage"
id="org.eclipse.cdt.autotools.ui.preferences1" id="org.eclipse.cdt.autotools.ui.preferences1"
name="%PreferencAutotools.name"> name="%PreferenceAutotools.name">
</page> </page>
<page <page
category="org.eclipse.cdt.autotools.ui.preferences1" category="org.eclipse.cdt.autotools.ui.preferences1"

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Symbian - Initial implementation * Symbian - Initial implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.pdom.tests; package org.eclipse.cdt.internal.pdom.tests;
@ -33,7 +33,6 @@ import org.eclipse.core.runtime.NullProgressMonitor;
* See bugzilla * See bugzilla
*/ */
public class FilesOnReindexTests extends PDOMTestBase { public class FilesOnReindexTests extends PDOMTestBase {
protected ICProject project; protected ICProject project;
protected IIndex pdom; protected IIndex pdom;
@ -72,7 +71,7 @@ public class FilesOnReindexTests extends PDOMTestBase {
void performAssertions(IFile file) throws CoreException { void performAssertions(IFile file) throws CoreException {
IIndex index = CCorePlugin.getIndexManager().getIndex(project); IIndex index = CCorePlugin.getIndexManager().getIndex(project);
assertNotNull(index.getFile(ILinkage.CPP_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(file))); assertTrue(index.getFiles(ILinkage.CPP_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(file)).length != 0);
IBinding[] bs = index.findBindings(Pattern.compile("C"), true, IndexFilter.ALL, new NullProgressMonitor()); IBinding[] bs = index.findBindings(Pattern.compile("C"), true, IndexFilter.ALL, new NullProgressMonitor());
assertEquals(1, bs.length); assertEquals(1, bs.length);

View file

@ -108,14 +108,14 @@ Export-Package: org.eclipse.cdt.core,
org.eclipse.cdt.utils.spawner, org.eclipse.cdt.utils.spawner,
org.eclipse.cdt.utils.xcoff, org.eclipse.cdt.utils.xcoff,
org.eclipse.cdt.utils.xcoff.parser org.eclipse.cdt.utils.xcoff.parser
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)", Require-Bundle: org.eclipse.core.contenttype;bundle-version="[3.3.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
org.eclipse.core.contenttype;bundle-version="[3.3.0,4.0.0)",
org.eclipse.text;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.variables;bundle-version="[3.1.100,4.0.0)",
org.eclipse.core.filebuffers;bundle-version="[3.2.0,4.0.0)", org.eclipse.core.filebuffers;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.filesystem;bundle-version="[1.1.0,2.0.0)", org.eclipse.core.filesystem;bundle-version="[1.1.0,2.0.0)",
org.eclipse.ltk.core.refactoring;bundle-version="3.4.0" org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
org.eclipse.core.variables;bundle-version="[3.1.100,4.0.0)",
org.eclipse.ltk.core.refactoring;bundle-version="3.4.0",
org.eclipse.text;bundle-version="[3.2.0,4.0.0)",
com.ibm.icu;bundle-version="4.4.2"
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.ibm.icu.text

View file

@ -447,14 +447,14 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
Map<ICElement, CElementInfo> newElements, IResource underlyingResource) throws CModelException { Map<ICElement, CElementInfo> newElements, IResource underlyingResource) throws CModelException {
TranslationUnitInfo unitInfo = (TranslationUnitInfo) info; TranslationUnitInfo unitInfo = (TranslationUnitInfo) info;
// generate structure // Generate structure
this.parse(newElements, pm); this.parse(newElements, pm);
// ///////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////
if (isWorkingCopy()) { if (isWorkingCopy()) {
ITranslationUnit original = ((IWorkingCopy)this).getOriginalElement(); ITranslationUnit original = ((IWorkingCopy)this).getOriginalElement();
// might be IResource.NULL_STAMP if original does not exist // Might be IResource.NULL_STAMP if original does not exist
IResource r = original.getResource(); IResource r = original.getResource();
if (r != null && r instanceof IFile) { if (r != null && r instanceof IFile) {
unitInfo.fTimestamp = ((IFile) r).getModificationStamp(); unitInfo.fTimestamp = ((IFile) r).getModificationStamp();
@ -499,7 +499,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
} else { } else {
workingCopy= new WorkingCopy(getParent(), getLocationURI(), getContentTypeId(), factory); workingCopy= new WorkingCopy(getParent(), getLocationURI(), getContentTypeId(), factory);
} }
// open the working copy now to ensure contents are that of the current state of this element // Open the working copy now to ensure contents are that of the current state of this element
workingCopy.open(monitor); workingCopy.open(monitor);
return workingCopy; return workingCopy;
} }
@ -541,7 +541,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
return null; return null;
} }
// create a new info and make it the current info // Create a new info and make it the current info
// (this will remove the info and its children just before storing the new infos) // (this will remove the info and its children just before storing the new infos)
CModelManager manager = CModelManager.getDefault(); CModelManager manager = CModelManager.getDefault();
boolean hadTemporaryCache = manager.hasTemporaryCache(); boolean hadTemporaryCache = manager.hasTemporaryCache();
@ -555,7 +555,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
Map<ICElement, CElementInfo> newElements = manager.getTemporaryCache(); Map<ICElement, CElementInfo> newElements = manager.getTemporaryCache();
openWhenClosed(info, monitor); openWhenClosed(info, monitor);
if (newElements.get(this) == null) { if (newElements.get(this) == null) {
// close any buffer that was opened for the new elements // Close any buffer that was opened for the new elements
Iterator<ICElement> iterator = newElements.keySet().iterator(); Iterator<ICElement> iterator = newElements.keySet().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
ICElement element = iterator.next(); ICElement element = iterator.next();
@ -593,13 +593,13 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
@Override @Override
protected IBuffer openBuffer(IProgressMonitor pm) throws CModelException { protected IBuffer openBuffer(IProgressMonitor pm) throws CModelException {
// create buffer - translation units only use default buffer factory // Create buffer - translation units only use default buffer factory
BufferManager bufManager = getBufferManager(); BufferManager bufManager = getBufferManager();
IBuffer buffer = getBufferFactory().createBuffer(this); IBuffer buffer = getBufferFactory().createBuffer(this);
if (buffer == null) if (buffer == null)
return null; return null;
// set the buffer source // Set the buffer source
if (buffer.getCharacters() == null) { if (buffer.getCharacters() == null) {
IResource resource = this.getResource(); IResource resource = this.getResource();
if (resource != null && resource.getType() == IResource.FILE) { if (resource != null && resource.getType() == IResource.FILE) {
@ -620,10 +620,10 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
} }
} }
// add buffer to buffer cache // Add buffer to buffer cache
bufManager.addBuffer(buffer); bufManager.addBuffer(buffer);
// listen to buffer changes // Listen to buffer changes
buffer.addBufferChangedListener(this); buffer.addBufferChangedListener(this);
return buffer; return buffer;
@ -889,6 +889,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
} }
private static final int[] CTX_LINKAGES= { ILinkage.CPP_LINKAGE_ID, ILinkage.C_LINKAGE_ID }; private static final int[] CTX_LINKAGES= { ILinkage.CPP_LINKAGE_ID, ILinkage.C_LINKAGE_ID };
public IIndexFile[] getContextToHeader(IIndex index, int style) { public IIndexFile[] getContextToHeader(IIndex index, int style) {
if (index != null && (style & AST_CONFIGURE_USING_SOURCE_CONTEXT) != 0) { if (index != null && (style & AST_CONFIGURE_USING_SOURCE_CONTEXT) != 0) {
try { try {

View file

@ -1671,9 +1671,8 @@ public class CPPSemantics {
dtor.accept(visitor); dtor.accept(visitor);
} }
break; break;
case eEnumeration:
case eClassType: default:
case eTemplateDeclaration:
break; break;
} }
} }
@ -1696,7 +1695,7 @@ public class CPPSemantics {
IASTFunctionDeclarator declarator = functionDef.getDeclarator(); IASTFunctionDeclarator declarator = functionDef.getDeclarator();
if (!((ICPPASTDeclSpecifier) declSpec).isFriend()) { if (!((ICPPASTDeclSpecifier) declSpec).isFriend()) {
// check the function itself // Check the function itself
IASTName declName = ASTQueries.findInnermostDeclarator(declarator).getName(); IASTName declName = ASTQueries.findInnermostDeclarator(declarator).getName();
ASTInternal.addName(scope, declName); ASTInternal.addName(scope, declName);
} }
@ -1710,21 +1709,22 @@ public class CPPSemantics {
declSpec.accept(visitor); declSpec.accept(visitor);
declarator.accept(visitor); declarator.accept(visitor);
break; break;
case eClassType:
case eTemplateDeclaration: default:
case eEnumeration:
break; break;
} }
} }
} }
/** /**
* Perform lookup in nominated namespaces that appear in the given scope. For unqualified lookups the method assumes * Perform lookup in nominated namespaces that appear in the given scope. For unqualified
* that transitive directives have been stored in the lookup-data. For qualified lookups the transitive directives * lookups the method assumes that transitive directives have been stored in the lookup-data.
* are considered if the lookup of the original directive returns empty. * For qualified lookups the transitive directives are considered if the lookup of the original
* directive returns empty.
* @param fileSet * @param fileSet
*/ */
private static void lookupInNominated(LookupData data, IIndexFileSet fileSet, ICPPNamespaceScope scope) throws DOMException { private static void lookupInNominated(LookupData data, IIndexFileSet fileSet,
ICPPNamespaceScope scope) throws DOMException {
List<ICPPNamespaceScope> allNominated= data.usingDirectives.remove(scope); List<ICPPNamespaceScope> allNominated= data.usingDirectives.remove(scope);
while (allNominated != null) { while (allNominated != null) {
for (ICPPNamespaceScope nominated : allNominated) { for (ICPPNamespaceScope nominated : allNominated) {
@ -1740,9 +1740,9 @@ public class CPPSemantics {
found = true; found = true;
} }
// in the qualified lookup we have to nominate the transitive directives only when // In the qualified lookup we have to nominate the transitive directives only when
// the lookup did not succeed. In the qualified case this is done earlier, when the directive // the lookup did not succeed. In the qualified case this is done earlier, when
// is encountered. // the directive is encountered.
if (!found && data.qualified() && !data.contentAssist) { if (!found && data.qualified() && !data.contentAssist) {
if (data.tu != null) { if (data.tu != null) {
data.tu.handleAdditionalDirectives(nominated); data.tu.handleAdditionalDirectives(nominated);
@ -1753,7 +1753,7 @@ public class CPPSemantics {
} }
} }
} }
// retry with transitive directives that may have been nominated in a qualified lookup // Retry with transitive directives that may have been nominated in a qualified lookup
allNominated= data.usingDirectives.remove(scope); allNominated= data.usingDirectives.remove(scope);
} }
} }
@ -1778,11 +1778,11 @@ public class CPPSemantics {
return null; return null;
} }
// bug 238180 // Bug 238180
if (candidate instanceof ICPPClassTemplatePartialSpecialization) if (candidate instanceof ICPPClassTemplatePartialSpecialization)
return null; return null;
// specialization is selected during instantiation // Specialization is selected during instantiation
if (candidate instanceof ICPPTemplateInstance) if (candidate instanceof ICPPTemplateInstance)
candidate= ((ICPPTemplateInstance) candidate).getSpecializedBinding(); candidate= ((ICPPTemplateInstance) candidate).getSpecializedBinding();
@ -1829,7 +1829,7 @@ public class CPPSemantics {
int pointOfDecl= -1; int pointOfDecl= -1;
if (obj instanceof ICPPInternalBinding) { if (obj instanceof ICPPInternalBinding) {
ICPPInternalBinding cpp = (ICPPInternalBinding) obj; ICPPInternalBinding cpp = (ICPPInternalBinding) obj;
// for bindings in global or namespace scope we don't know whether there is a // For bindings in global or namespace scope we don't know whether there is a
// previous declaration in one of the skipped header files. For bindings that // previous declaration in one of the skipped header files. For bindings that
// are likely to be redeclared we need to assume that there is a declaration // are likely to be redeclared we need to assume that there is a declaration
// in one of the headers. // in one of the headers.
@ -1865,7 +1865,8 @@ public class CPPSemantics {
if (pointOfDecl < 0 && nd != null) { if (pointOfDecl < 0 && nd != null) {
ASTNodeProperty prop = nd.getPropertyInParent(); ASTNodeProperty prop = nd.getPropertyInParent();
if (prop == IASTDeclarator.DECLARATOR_NAME || nd instanceof IASTDeclarator) { if (prop == IASTDeclarator.DECLARATOR_NAME || nd instanceof IASTDeclarator) {
// point of declaration for a name is immediately after its complete declarator and before its initializer // Point of declaration for a name is immediately after its complete declarator
// and before its initializer.
IASTDeclarator dtor = (IASTDeclarator)((nd instanceof IASTDeclarator) ? nd : nd.getParent()); IASTDeclarator dtor = (IASTDeclarator)((nd instanceof IASTDeclarator) ? nd : nd.getParent());
while (dtor.getParent() instanceof IASTDeclarator) while (dtor.getParent() instanceof IASTDeclarator)
dtor = (IASTDeclarator) dtor.getParent(); dtor = (IASTDeclarator) dtor.getParent();
@ -1875,7 +1876,8 @@ public class CPPSemantics {
else else
pointOfDecl = ((ASTNode) dtor).getOffset() + ((ASTNode) dtor).getLength(); pointOfDecl = ((ASTNode) dtor).getOffset() + ((ASTNode) dtor).getLength();
} else if (prop == IASTEnumerator.ENUMERATOR_NAME) { } else if (prop == IASTEnumerator.ENUMERATOR_NAME) {
// point of declaration for an enumerator is immediately after it enumerator-definition // Point of declaration for an enumerator is immediately after it
// enumerator-definition
IASTEnumerator enumtor = (IASTEnumerator) nd.getParent(); IASTEnumerator enumtor = (IASTEnumerator) nd.getParent();
if (enumtor.getValue() != null) { if (enumtor.getValue() != null) {
ASTNode exp = (ASTNode) enumtor.getValue(); ASTNode exp = (ASTNode) enumtor.getValue();
@ -1906,7 +1908,7 @@ public class CPPSemantics {
} else if (cpp instanceof ICompositeType || cpp instanceof IEnumeration) { } else if (cpp instanceof ICompositeType || cpp instanceof IEnumeration) {
IScope scope= cpp.getScope(); IScope scope= cpp.getScope();
if (!(scope instanceof ICPPBlockScope) && scope instanceof ICPPNamespaceScope) { if (!(scope instanceof ICPPBlockScope) && scope instanceof ICPPNamespaceScope) {
// if this is not the definition, it may be found in a header. (bug 229571) // If this is not the definition, it may be found in a header. (bug 229571)
if (cpp.getDefinition() == null) { if (cpp.getDefinition() == null) {
return true; return true;
} }
@ -1956,7 +1958,7 @@ public class CPPSemantics {
continue; continue;
} }
// select among those bindings that have been created without problems. // Select among those bindings that have been created without problems.
if (temp instanceof IProblemBinding) if (temp instanceof IProblemBinding)
continue; continue;
@ -1984,7 +1986,7 @@ public class CPPSemantics {
fns = new ObjectSet<ICPPFunction>(2); fns = new ObjectSet<ICPPFunction>(2);
fns.put((ICPPFunction) temp); fns.put((ICPPFunction) temp);
} else if (temp instanceof IType) { } else if (temp instanceof IType) {
// specializations are selected during instantiation // Specializations are selected during instantiation
if (temp instanceof ICPPClassTemplatePartialSpecialization) if (temp instanceof ICPPClassTemplatePartialSpecialization)
continue; continue;
if (temp instanceof ICPPTemplateInstance) { if (temp instanceof ICPPTemplateInstance) {
@ -2213,7 +2215,7 @@ public class CPPSemantics {
return -1; // function from ast return -1; // function from ast
} }
} }
// everything is from the index // Everything is from the index
if (!isReachableFromAst(data.tu, obj)) { if (!isReachableFromAst(data.tu, obj)) {
return -1; // obj not reachable return -1; // obj not reachable
} }

View file

@ -2125,7 +2125,7 @@ public class CPPVisitor extends ASTQueries {
} }
IType type = expr.getExpressionType(); IType type = expr.getExpressionType();
if (spec.getType() == IASTSimpleDeclSpecifier.t_decltype) { if (spec.getType() == IASTSimpleDeclSpecifier.t_decltype) {
switch((expr).getValueCategory()) { switch (expr.getValueCategory()) {
case XVALUE: case XVALUE:
type= new CPPReferenceType(type, true); type= new CPPReferenceType(type, true);
break; break;

View file

@ -102,7 +102,7 @@ public class CIndex implements IIndex {
public IIndexBinding[] findBindings(Pattern[] patterns, boolean isFullyQualified, IndexFilter filter, public IIndexBinding[] findBindings(Pattern[] patterns, boolean isFullyQualified, IndexFilter filter,
IProgressMonitor monitor) throws CoreException { IProgressMonitor monitor) throws CoreException {
if (SPECIALCASE_SINGLES && fFragments.length == 1) { if (SPECIALCASE_SINGLES && fFragments.length == 1) {
return fFragments[0].findBindings(patterns, isFullyQualified, filter, monitor); return fFragments[0].findBindings(patterns, isFullyQualified, filter, monitor);
} else { } else {
List<IIndexBinding[]> result = new ArrayList<IIndexBinding[]>(); List<IIndexBinding[]> result = new ArrayList<IIndexBinding[]>();
ILinkage[] linkages = Linkage.getIndexerLinkages(); ILinkage[] linkages = Linkage.getIndexerLinkages();

View file

@ -208,7 +208,7 @@ public class PDOM extends PlatformObject implements IPDOM {
* #114.0# - Partial specializations for class template specializations, bug 332884. * #114.0# - Partial specializations for class template specializations, bug 332884.
* - Corrected signatures for function templates, bug 335062. <<CDT 8.0>> * - Corrected signatures for function templates, bug 335062. <<CDT 8.0>>
* *
* CDT 8.1 development (versions not supported on teh 8.0.x branch) * CDT 8.1 development (versions not supported on the 8.0.x branch)
* 120.0 - Enumerators in global index, bug 356235 * 120.0 - Enumerators in global index, bug 356235
* 120.1 - Specializations of using declarations, bug 357293. * 120.1 - Specializations of using declarations, bug 357293.
* 121.0 - Multiple variants of included header file, bug 197989. * 121.0 - Multiple variants of included header file, bug 197989.
@ -469,6 +469,7 @@ public class PDOM extends PlatformObject implements IPDOM {
public int compare(long record) throws CoreException { public int compare(long record) throws CoreException {
return 0; return 0;
} }
@Override @Override
public boolean visit(long record) throws CoreException { public boolean visit(long record) throws CoreException {
PDOMFile file = PDOMFile.recreateFile(PDOM.this, record); PDOMFile file = PDOMFile.recreateFile(PDOM.this, record);

View file

@ -10,19 +10,17 @@
* Andrew Ferguson (Symbian) - Provide B-tree deletion routine * Andrew Ferguson (Symbian) - Provide B-tree deletion routine
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.db; package org.eclipse.cdt.internal.core.pdom.db;
import com.ibm.icu.text.MessageFormat;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import com.ibm.icu.text.MessageFormat;
/** /**
* @author Doug Schaefer * @author Doug Schaefer
*
*/ */
public class BTree { public class BTree {
// Constants for internal deletion routine (see deleteImp doc) // Constants for internal deletion routine (see deleteImp doc)
@ -53,7 +51,7 @@ public class BTree {
* @param rootPointer offset into database of the pointer to the root node * @param rootPointer offset into database of the pointer to the root node
*/ */
public BTree(Database db, long rootPointer, int degree, IBTreeComparator cmp) { public BTree(Database db, long rootPointer, int degree, IBTreeComparator cmp) {
if(degree<2) if (degree < 2)
throw new IllegalArgumentException(Messages.getString("BTree.IllegalDegree")); //$NON-NLS-1$ throw new IllegalArgumentException(Messages.getString("BTree.IllegalDegree")); //$NON-NLS-1$
this.db = db; this.db = db;
@ -113,10 +111,10 @@ public class BTree {
// if this node is full (last record isn't null), split it // if this node is full (last record isn't null), split it
if (getRecord(chunk, node, MAX_RECORDS - 1) != 0) { if (getRecord(chunk, node, MAX_RECORDS - 1) != 0) {
long median = getRecord(chunk, node, MEDIAN_RECORD); long median = getRecord(chunk, node, MEDIAN_RECORD);
if (median == record) if (median == record) {
// found it, never mind // found it, never mind
return median; return median;
else { } else {
// split it // split it
// create the new node and move the larger records over // create the new node and move the larger records over
long newnode = allocateNode(); long newnode = allocateNode();
@ -161,8 +159,8 @@ public class BTree {
// binary search to find the insert point // binary search to find the insert point
int lower= 0; int lower= 0;
int upper= MAX_RECORDS-1; int upper= MAX_RECORDS - 1;
while (lower < upper && getRecord(chunk, node, upper-1) == 0) { while (lower < upper && getRecord(chunk, node, upper - 1) == 0) {
upper--; upper--;
} }
@ -171,16 +169,13 @@ public class BTree {
long checkRec= getRecord(chunk, node, middle); long checkRec= getRecord(chunk, node, middle);
if (checkRec == 0) { if (checkRec == 0) {
upper= middle; upper= middle;
} } else {
else {
int compare= cmp.compare(checkRec, record); int compare= cmp.compare(checkRec, record);
if (compare > 0) { if (compare > 0) {
upper= middle; upper= middle;
} } else if (compare < 0) {
else if (compare < 0) { lower= middle + 1;
lower= middle+1; } else {
}
else {
// found it, no insert, just return the record // found it, no insert, just return the record
return record; return record;
} }
@ -256,16 +251,16 @@ public class BTree {
BTNode(long node) throws CoreException { BTNode(long node) throws CoreException {
this.node = node; this.node = node;
this.chunk = db.getChunk(node); this.chunk = db.getChunk(node);
int i=0; int i= 0;
while(i<MAX_RECORDS && getRecord(chunk, node, i)!=0) while (i < MAX_RECORDS && getRecord(chunk, node, i) != 0)
i++; i++;
keyCount = i; keyCount = i;
} }
private BTNode getChild(int index) throws CoreException { private BTNode getChild(int index) throws CoreException {
if(0<=index && index<MAX_CHILDREN) { if (0 <= index && index < MAX_CHILDREN) {
long child = BTree.this.getChild(chunk, node, index); long child = BTree.this.getChild(chunk, node, index);
if(child!=0) if (child != 0)
return new BTNode(child); return new BTNode(child);
} }
return null; return null;
@ -295,38 +290,38 @@ public class BTree {
// Determine index of key in current node, or -1 if its not in this node // Determine index of key in current node, or -1 if its not in this node
int keyIndexInNode = -1; int keyIndexInNode = -1;
if(mode==DELMODE_NORMAL) if (mode == DELMODE_NORMAL)
for(int i=0; i<node.keyCount; i++) for (int i= 0; i < node.keyCount; i++)
if(getRecord(node.chunk, node.node, i) == key) { if (getRecord(node.chunk, node.node, i) == key) {
keyIndexInNode = i; keyIndexInNode = i;
break; break;
} }
if(getChild(node.chunk, node.node, 0)==0) { if (getChild(node.chunk, node.node, 0) == 0) {
/* Case 1: leaf node containing the key (by method precondition) */ /* Case 1: leaf node containing the key (by method precondition) */
if(keyIndexInNode!=-1) { if (keyIndexInNode != -1) {
nodeContentDelete(node, keyIndexInNode, 1); nodeContentDelete(node, keyIndexInNode, 1);
return key; return key;
} else { } else {
if(mode==DELMODE_DELETE_MINIMUM) { if (mode == DELMODE_DELETE_MINIMUM) {
long subst = getRecord(node.chunk, node.node, 0); long subst = getRecord(node.chunk, node.node, 0);
nodeContentDelete(node, 0, 1); nodeContentDelete(node, 0, 1);
return subst; return subst;
} else if(mode==DELMODE_DELETE_MAXIMUM) { } else if (mode == DELMODE_DELETE_MAXIMUM) {
long subst = getRecord(node.chunk, node.node, node.keyCount-1); long subst = getRecord(node.chunk, node.node, node.keyCount - 1);
nodeContentDelete(node, node.keyCount-1, 1); nodeContentDelete(node, node.keyCount - 1, 1);
return subst; return subst;
} }
throw new BTreeKeyNotFoundException( throw new BTreeKeyNotFoundException(
MessageFormat.format(Messages.getString("BTree.DeletionOnAbsentKey"), //$NON-NLS-1$ MessageFormat.format(Messages.getString("BTree.DeletionOnAbsentKey"), //$NON-NLS-1$
new Object[]{new Long(key), new Integer(mode)})); new Object[] { new Long(key), new Integer(mode) }));
} }
} else { } else {
if(keyIndexInNode != -1) { if (keyIndexInNode != -1) {
/* Case 2: non-leaf node which contains the key itself */ /* Case 2: non-leaf node which contains the key itself */
BTNode succ = node.getChild(keyIndexInNode+1); BTNode succ = node.getChild(keyIndexInNode + 1);
if(succ!=null && succ.keyCount > MIN_RECORDS) { if (succ != null && succ.keyCount > MIN_RECORDS) {
/* Case 2a: Delete key by overwriting it with its successor (which occurs in a leaf node) */ /* Case 2a: Delete key by overwriting it with its successor (which occurs in a leaf node) */
long subst = deleteImp(-1, succ.node, DELMODE_DELETE_MINIMUM); long subst = deleteImp(-1, succ.node, DELMODE_DELETE_MINIMUM);
putRecord(node.chunk, node.node, keyIndexInNode, subst); putRecord(node.chunk, node.node, keyIndexInNode, subst);
@ -334,7 +329,7 @@ public class BTree {
} }
BTNode pred = node.getChild(keyIndexInNode); BTNode pred = node.getChild(keyIndexInNode);
if(pred!=null && pred.keyCount > MIN_RECORDS) { if (pred != null && pred.keyCount > MIN_RECORDS) {
/* Case 2b: Delete key by overwriting it with its predecessor (which occurs in a leaf node) */ /* Case 2b: Delete key by overwriting it with its predecessor (which occurs in a leaf node) */
long subst = deleteImp(-1, pred.node, DELMODE_DELETE_MAXIMUM); long subst = deleteImp(-1, pred.node, DELMODE_DELETE_MAXIMUM);
putRecord(node.chunk, node.node, keyIndexInNode, subst); putRecord(node.chunk, node.node, keyIndexInNode, subst);
@ -342,7 +337,7 @@ public class BTree {
} }
/* Case 2c: Merge successor and predecessor */ /* Case 2c: Merge successor and predecessor */
// assert(pred!=null && succ!=null); // assert(pred != null && succ != null);
if (pred != null) { if (pred != null) {
mergeNodes(succ, node, keyIndexInNode, pred); mergeNodes(succ, node, keyIndexInNode, pred);
return deleteImp(key, pred.node, mode); return deleteImp(key, pred.node, mode);
@ -356,8 +351,8 @@ public class BTree {
switch(mode) { switch(mode) {
case DELMODE_NORMAL: case DELMODE_NORMAL:
subtreeIndex = node.keyCount; subtreeIndex = node.keyCount;
for(int i=0; i<node.keyCount; i++) for (int i= 0; i < node.keyCount; i++)
if(cmp.compare(getRecord(node.chunk, node.node, i), key)>0) { if (cmp.compare(getRecord(node.chunk, node.node, i), key)>0) {
subtreeIndex = i; subtreeIndex = i;
break; break;
} }
@ -368,15 +363,15 @@ public class BTree {
} }
BTNode child = node.getChild(subtreeIndex); BTNode child = node.getChild(subtreeIndex);
if(child==null) { if (child == null) {
throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, IStatus.OK, Messages.getString("BTree.IntegrityError"), null)); //$NON-NLS-1$ throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, IStatus.OK, Messages.getString("BTree.IntegrityError"), null)); //$NON-NLS-1$
} }
if(child.keyCount > MIN_RECORDS) { if (child.keyCount > MIN_RECORDS) {
return deleteImp(key, child.node, mode); return deleteImp(key, child.node, mode);
} else { } else {
BTNode sibR = node.getChild(subtreeIndex+1); BTNode sibR = node.getChild(subtreeIndex + 1);
if(sibR!=null && sibR.keyCount > MIN_RECORDS) { if (sibR != null && sibR.keyCount > MIN_RECORDS) {
/* Case 3a (i): child will underflow upon deletion, take a key from rightSibling */ /* Case 3a (i): child will underflow upon deletion, take a key from rightSibling */
long rightKey = getRecord(node.chunk, node.node, subtreeIndex); long rightKey = getRecord(node.chunk, node.node, subtreeIndex);
long leftmostRightSiblingKey = getRecord(sibR.chunk, sibR.node, 0); long leftmostRightSiblingKey = getRecord(sibR.chunk, sibR.node, 0);
@ -386,26 +381,26 @@ public class BTree {
return deleteImp(key, child.node, mode); return deleteImp(key, child.node, mode);
} }
BTNode sibL = node.getChild(subtreeIndex-1); BTNode sibL = node.getChild(subtreeIndex - 1);
if(sibL!=null && sibL.keyCount > MIN_RECORDS) { if (sibL != null && sibL.keyCount > MIN_RECORDS) {
/* Case 3a (ii): child will underflow upon deletion, take a key from leftSibling */ /* Case 3a (ii): child will underflow upon deletion, take a key from leftSibling */
long leftKey = getRecord(node.chunk, node.node, subtreeIndex-1); long leftKey = getRecord(node.chunk, node.node, subtreeIndex - 1);
prepend(child, leftKey, getChild(sibL.chunk, sibL.node, sibL.keyCount)); prepend(child, leftKey, getChild(sibL.chunk, sibL.node, sibL.keyCount));
long rightmostLeftSiblingKey = getRecord(sibL.chunk, sibL.node, sibL.keyCount-1); long rightmostLeftSiblingKey = getRecord(sibL.chunk, sibL.node, sibL.keyCount - 1);
putRecord(sibL.chunk, sibL.node, sibL.keyCount-1, 0); putRecord(sibL.chunk, sibL.node, sibL.keyCount - 1, 0);
putChild(sibL.chunk, sibL.node, sibL.keyCount, 0); putChild(sibL.chunk, sibL.node, sibL.keyCount, 0);
putRecord(node.chunk, node.node, subtreeIndex-1, rightmostLeftSiblingKey); putRecord(node.chunk, node.node, subtreeIndex - 1, rightmostLeftSiblingKey);
return deleteImp(key, child.node, mode); return deleteImp(key, child.node, mode);
} }
/* Case 3b (i,ii): leftSibling, child, rightSibling all have minimum number of keys */ /* Case 3b (i,ii): leftSibling, child, rightSibling all have minimum number of keys */
if(sibL!=null) { // merge child into leftSibling if (sibL != null) { // merge child into leftSibling
mergeNodes(child, node, subtreeIndex-1, sibL); mergeNodes(child, node, subtreeIndex - 1, sibL);
return deleteImp(key, sibL.node, mode); return deleteImp(key, sibL.node, mode);
} }
if(sibR!=null) { // merge rightSibling into child if (sibR != null) { // merge rightSibling into child
mergeNodes(sibR, node, subtreeIndex, child); mergeNodes(sibR, node, subtreeIndex, child);
return deleteImp(key, child.node, mode); return deleteImp(key, child.node, mode);
} }
@ -429,21 +424,21 @@ public class BTree {
*/ */
public void mergeNodes(BTNode src, BTNode keyProvider, int kIndex, BTNode dst) public void mergeNodes(BTNode src, BTNode keyProvider, int kIndex, BTNode dst)
throws CoreException { throws CoreException {
nodeContentCopy(src, 0, dst, dst.keyCount+1, src.keyCount+1); nodeContentCopy(src, 0, dst, dst.keyCount + 1, src.keyCount + 1);
long midKey = getRecord(keyProvider.chunk, keyProvider.node, kIndex); long midKey = getRecord(keyProvider.chunk, keyProvider.node, kIndex);
putRecord(dst.chunk, dst.node, dst.keyCount, midKey); putRecord(dst.chunk, dst.node, dst.keyCount, midKey);
long keySucc = kIndex+1 == MAX_RECORDS ? 0 : getRecord(keyProvider.chunk, keyProvider.node, kIndex+1); long keySucc = kIndex + 1 == MAX_RECORDS ? 0 : getRecord(keyProvider.chunk, keyProvider.node, kIndex + 1);
db.free(getChild(keyProvider.chunk, keyProvider.node, kIndex+1)); db.free(getChild(keyProvider.chunk, keyProvider.node, kIndex + 1));
nodeContentDelete(keyProvider, kIndex+1, 1); nodeContentDelete(keyProvider, kIndex + 1, 1);
putRecord(keyProvider.chunk, keyProvider.node, kIndex, keySucc); putRecord(keyProvider.chunk, keyProvider.node, kIndex, keySucc);
if(kIndex == 0 && keySucc == 0) { if (kIndex == 0 && keySucc == 0) {
/* /*
* The root node is excused from the property that a node must have a least MIN keys * The root node is excused from the property that a node must have a least MIN keys
* This means we must special case it at the point when its had all of its keys deleted * This means we must special case it at the point when its had all of its keys deleted
* entirely during merge operations (which push one of its keys down as a pivot) * entirely during merge operations (which push one of its keys down as a pivot)
*/ */
long rootNode = getRoot(); long rootNode = getRoot();
if(rootNode == keyProvider.node) { if (rootNode == keyProvider.node) {
db.putRecPtr(rootPointer, dst.node); db.putRecPtr(rootPointer, dst.node);
db.free(rootNode); db.free(rootNode);
} }
@ -458,7 +453,7 @@ public class BTree {
* @param child the new leftmost (least) subtree root * @param child the new leftmost (least) subtree root
*/ */
private void prepend(BTNode node, long key, long child) { private void prepend(BTNode node, long key, long child) {
nodeContentCopy(node, 0, node, 1, node.keyCount+1); nodeContentCopy(node, 0, node, 1, node.keyCount + 1);
putRecord(node.chunk, node.node, 0, key); putRecord(node.chunk, node.node, 0, key);
putChild(node.chunk, node.node, 0, child); putChild(node.chunk, node.node, 0, child);
} }
@ -487,15 +482,15 @@ public class BTree {
* @param length the number of (key,(predecessor)child) nodes to write * @param length the number of (key,(predecessor)child) nodes to write
*/ */
private void nodeContentCopy(BTNode src, int srcPos, BTNode dst, int dstPos, int length) { private void nodeContentCopy(BTNode src, int srcPos, BTNode dst, int dstPos, int length) {
for(int i=length-1; i>=0; i--) { // this order is important when src==dst! for (int i=length - 1; i >= 0; i--) { // this order is important when src == dst!
int srcIndex = srcPos + i; int srcIndex = srcPos + i;
int dstIndex = dstPos + i; int dstIndex = dstPos + i;
if(srcIndex<src.keyCount+1) { if (srcIndex < src.keyCount + 1) {
long srcChild = getChild(src.chunk, src.node, srcIndex); long srcChild = getChild(src.chunk, src.node, srcIndex);
putChild(dst.chunk, dst.node, dstIndex, srcChild); putChild(dst.chunk, dst.node, dstIndex, srcChild);
if(srcIndex<src.keyCount) { if (srcIndex < src.keyCount) {
long srcKey = getRecord(src.chunk, src.node, srcIndex); long srcKey = getRecord(src.chunk, src.node, srcIndex);
putRecord(dst.chunk, dst.node, dstIndex, srcKey); putRecord(dst.chunk, dst.node, dstIndex, srcKey);
} }
@ -513,13 +508,13 @@ public class BTree {
* @param length the length of the sequence to delete * @param length the length of the sequence to delete
*/ */
private void nodeContentDelete(BTNode node, int i, int length) { private void nodeContentDelete(BTNode node, int i, int length) {
for(int index=i; index<=MAX_RECORDS; index++) { for (int index= i; index <= MAX_RECORDS; index++) {
long newKey = (index+length) < node.keyCount ? getRecord(node.chunk, node.node, index+length) : 0; long newKey = (index + length) < node.keyCount ? getRecord(node.chunk, node.node, index + length) : 0;
long newChild = (index+length) < node.keyCount+1 ? getChild(node.chunk, node.node, index+length) : 0; long newChild = (index + length) < node.keyCount + 1 ? getChild(node.chunk, node.node, index + length) : 0;
if(index<MAX_RECORDS) { if (index < MAX_RECORDS) {
putRecord(node.chunk, node.node, index, newKey); putRecord(node.chunk, node.node, index, newKey);
} }
if(index<MAX_CHILDREN) { if (index < MAX_CHILDREN) {
putChild(node.chunk, node.node, index, newChild); putChild(node.chunk, node.node, index, newChild);
} }
} }
@ -543,8 +538,8 @@ public class BTree {
if (node == 0) { if (node == 0) {
return true; return true;
} }
if(visitor instanceof IBTreeVisitor2) { if (visitor instanceof IBTreeVisitor2) {
((IBTreeVisitor2)visitor).preNode(node); ((IBTreeVisitor2) visitor).preNode(node);
} }
try { try {
@ -552,23 +547,21 @@ public class BTree {
// binary search to find first record greater or equal // binary search to find first record greater or equal
int lower= 0; int lower= 0;
int upper= MAX_RECORDS-1; int upper= MAX_RECORDS - 1;
while (lower < upper && getRecord(chunk, node, upper-1) == 0) { while (lower < upper && getRecord(chunk, node, upper - 1) == 0) {
upper--; upper--;
} }
while (lower < upper) { while (lower < upper) {
int middle= (lower+upper)/2; int middle= (lower + upper) / 2;
long checkRec = getRecord(chunk, node, middle); long checkRec = getRecord(chunk, node, middle);
if (checkRec == 0) { if (checkRec == 0) {
upper= middle; upper= middle;
} } else {
else {
int compare= visitor.compare(checkRec); int compare= visitor.compare(checkRec);
if (compare >= 0) { if (compare >= 0) {
upper= middle; upper= middle;
} } else {
else { lower= middle + 1;
lower= middle+1;
} }
} }
} }
@ -584,8 +577,7 @@ public class BTree {
if (compare > 0) { if (compare > 0) {
// start point is to the left // start point is to the left
return accept(getChild(chunk, node, i), visitor); return accept(getChild(chunk, node, i), visitor);
} } else if (compare == 0) {
else if (compare == 0) {
if (!accept(getChild(chunk, node, i), visitor)) if (!accept(getChild(chunk, node, i), visitor))
return false; return false;
if (!visitor.visit(record)) if (!visitor.visit(record))
@ -594,8 +586,8 @@ public class BTree {
} }
return accept(getChild(chunk, node, i), visitor); return accept(getChild(chunk, node, i), visitor);
} finally { } finally {
if(visitor instanceof IBTreeVisitor2) { if (visitor instanceof IBTreeVisitor2) {
((IBTreeVisitor2)visitor).postNode(node); ((IBTreeVisitor2) visitor).postNode(node);
} }
} }
} }
@ -648,56 +640,56 @@ public class BTree {
int keyCount = 0; int keyCount = 0;
int indexFirstBlankKey = MAX_RECORDS; int indexFirstBlankKey = MAX_RECORDS;
int indexLastNonBlankKey = 0; int indexLastNonBlankKey = 0;
for(int i=0; i<MAX_RECORDS; i++) { for (int i= 0; i < MAX_RECORDS; i++) {
if(getRecord(db.getChunk(node), node, i)!=0) { if (getRecord(db.getChunk(node), node, i) != 0) {
keyCount++; keyCount++;
indexLastNonBlankKey = i; indexLastNonBlankKey = i;
} else if(indexFirstBlankKey== MAX_RECORDS){ } else if (indexFirstBlankKey == MAX_RECORDS) {
indexFirstBlankKey = i; indexFirstBlankKey = i;
} }
} }
int childCount = 0; int childCount = 0;
for(int i=0; i<MAX_CHILDREN; i++) { for (int i= 0; i < MAX_CHILDREN; i++) {
if(getChild(db.getChunk(node), node, i)!=0) { if (getChild(db.getChunk(node), node, i) != 0) {
childCount++; childCount++;
} }
} }
// check that non-blank keys are contiguous and blank key terminated // check that non-blank keys are contiguous and blank key terminated
if(indexFirstBlankKey != indexLastNonBlankKey+1) { if (indexFirstBlankKey != indexLastNonBlankKey + 1) {
boolean full = indexFirstBlankKey == MAX_RECORDS && indexLastNonBlankKey == MAX_RECORDS-1; boolean full = indexFirstBlankKey == MAX_RECORDS && indexLastNonBlankKey == MAX_RECORDS - 1;
boolean empty = indexFirstBlankKey == 0 && indexLastNonBlankKey == 0; boolean empty = indexFirstBlankKey == 0 && indexLastNonBlankKey == 0;
if(!full && !empty){ if (!full && !empty) {
valid = false; valid = false;
msg += MessageFormat.format(Messages.getString("BTree.IntegrityErrorA"), //$NON-NLS-1$ msg += MessageFormat.format(Messages.getString("BTree.IntegrityErrorA"), //$NON-NLS-1$
new Object[]{new Long(node), new Integer(indexFirstBlankKey), new Integer(indexLastNonBlankKey)}); new Object[] { new Long(node), new Integer(indexFirstBlankKey), new Integer(indexLastNonBlankKey) });
} }
} }
// Check: Key number constrains child numbers // Check: Key number constrains child numbers
if(childCount!=0 && childCount!=keyCount+1) { if (childCount != 0 && childCount != keyCount + 1) {
valid = false; valid = false;
msg += MessageFormat.format(Messages.getString("BTree.IntegrityErrorB"), new Object[]{new Long(node)}); //$NON-NLS-1$ msg += MessageFormat.format(Messages.getString("BTree.IntegrityErrorB"), new Object[] { new Long(node) }); //$NON-NLS-1$
} }
// the root node is excused from the remaining node constraints // the root node is excused from the remaining node constraints
if(node == db.getRecPtr(rootPointer)) { if (node == db.getRecPtr(rootPointer)) {
return; return;
} }
// Check: Non-root nodes must have a keyCount within a certain range // Check: Non-root nodes must have a keyCount within a certain range
if(keyCount < MIN_RECORDS || keyCount > MAX_RECORDS) { if (keyCount < MIN_RECORDS || keyCount > MAX_RECORDS) {
valid = false; valid = false;
msg += MessageFormat.format(Messages.getString("BTree.IntegrityErrorC"), new Object[]{new Long(node)}); //$NON-NLS-1$ msg += MessageFormat.format(Messages.getString("BTree.IntegrityErrorC"), new Object[] { new Long(node) }); //$NON-NLS-1$
} }
// Check: All leaf nodes are at the same depth // Check: All leaf nodes are at the same depth
if(childCount==0) { if (childCount == 0) {
if(leafDepth==null) { if (leafDepth == null) {
leafDepth = new Integer(depth); leafDepth = new Integer(depth);
} }
if(depth!=leafDepth.intValue()) { if (depth != leafDepth.intValue()) {
valid = false; valid = false;
msg += Messages.getString("BTree.IntegrityErrorD"); //$NON-NLS-1$ msg += Messages.getString("BTree.IntegrityErrorD"); //$NON-NLS-1$
} }

View file

@ -16,6 +16,7 @@ import java.io.OutputStream;
import java.util.Properties; import java.util.Properties;
import org.eclipse.cdt.internal.core.Cygwin; import org.eclipse.cdt.internal.core.Cygwin;
import org.eclipse.cdt.internal.core.Messages;
import org.eclipse.cdt.internal.core.ProcessClosure; import org.eclipse.cdt.internal.core.ProcessClosure;
import org.eclipse.cdt.utils.PathUtil; import org.eclipse.cdt.utils.PathUtil;
import org.eclipse.cdt.utils.spawner.EnvironmentReader; import org.eclipse.cdt.utils.spawner.EnvironmentReader;
@ -25,6 +26,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.osgi.util.NLS;
/** /**
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
@ -125,18 +127,20 @@ public class CommandLauncher implements ICommandLauncher {
/** /**
* Parse array of "ENV=value" pairs to Properties. * Parse array of "ENV=value" pairs to Properties.
*/ */
private Properties parseEnv(String[] env) { private void parseEnvironment(String[] env) {
Properties envProperties = new Properties(); fEnvironment = null;
for (String envStr : env) { if (env != null) {
// Split "ENV=value" and put in Properties fEnvironment = new Properties();
int pos = envStr.indexOf('='); for (String envStr : env) {
if (pos < 0) // Split "ENV=value" and put in Properties
pos = envStr.length(); int pos = envStr.indexOf('=');
String key = envStr.substring(0, pos); if (pos < 0)
String value = envStr.substring(pos + 1); pos = envStr.length();
envProperties.put(key, value); String key = envStr.substring(0, pos);
String value = envStr.substring(pos + 1);
fEnvironment.put(key, value);
}
} }
return envProperties;
} }
/** /**
@ -160,27 +164,28 @@ public class CommandLauncher implements ICommandLauncher {
*/ */
@Override @Override
public Process execute(IPath commandPath, String[] args, String[] env, IPath workingDirectory, IProgressMonitor monitor) throws CoreException { public Process execute(IPath commandPath, String[] args, String[] env, IPath workingDirectory, IProgressMonitor monitor) throws CoreException {
parseEnvironment(env);
String envPathValue = (String) getEnvironment().get(PATH_ENV);
Boolean isFound = null; Boolean isFound = null;
String command = commandPath.toOSString(); String command = commandPath.toOSString();
String envPathValue = (String) getEnvironment().get(PATH_ENV); fCommandArgs = constructCommandArray(command, args);
try { if (Platform.getOS().equals(Platform.OS_WIN32)) {
fCommandArgs = constructCommandArray(command, args); // Handle cygwin link
if (Platform.getOS().equals(Platform.OS_WIN32)) { IPath location = PathUtil.findProgramLocation(command, envPathValue);
// Handle cygwin link isFound = location != null;
IPath location = PathUtil.findProgramLocation(command, envPathValue); if (location != null) {
isFound = location != null; try {
if (location != null) { fCommandArgs[0] = Cygwin.cygwinToWindowsPath(location.toString(), envPathValue);
try { } catch (Exception e) {
fCommandArgs[0] = Cygwin.cygwinToWindowsPath(location.toString(), envPathValue); // if no cygwin nothing to worry about
} catch (Exception e) {
// if no cygwin nothing to worry about
}
} }
} }
}
fEnvironment = parseEnv(env); File dir = workingDirectory != null ? workingDirectory.toFile() : null;
File dir = workingDirectory != null ? workingDirectory.toFile() : null;
try {
fProcess = ProcessFactory.getFactory().exec(fCommandArgs, env, dir); fProcess = ProcessFactory.getFactory().exec(fCommandArgs, env, dir);
fCommandArgs[0] = command; // to print original command on the console fCommandArgs[0] = command; // to print original command on the console
fErrorMessage = ""; //$NON-NLS-1$ fErrorMessage = ""; //$NON-NLS-1$
@ -201,8 +206,8 @@ public class CommandLauncher implements ICommandLauncher {
envPathValue = System.getenv(PATH_ENV); envPathValue = System.getenv(PATH_ENV);
} }
errorMessage = errorMessage + NEWLINE errorMessage = errorMessage + NEWLINE
+ "Error: Program \"" + command + "\" not found in PATH" + NEWLINE + NLS.bind(Messages.CommandLauncher_ProgramNotFoundInPath, command) + NEWLINE
+ "PATH=[" + envPathValue + "]" + NEWLINE; + "PATH=[" + envPathValue + "]" + NEWLINE; //$NON-NLS-1$ //$NON-NLS-2$
} }
setErrorMessage(errorMessage); setErrorMessage(errorMessage);
fProcess = null; fProcess = null;
@ -258,7 +263,7 @@ public class CommandLauncher implements ICommandLauncher {
if (monitor.isCanceled()) { if (monitor.isCanceled()) {
closure.terminate(); closure.terminate();
state = COMMAND_CANCELED; state = COMMAND_CANCELED;
setErrorMessage(CCorePlugin.getResourceString("CommandLauncher.error.commandCanceled")); //$NON-NLS-1$ setErrorMessage(Messages.CommandLauncher_CommandCancelled);
} }
try { try {

View file

@ -26,8 +26,6 @@ CoreModel.PathEntry.DuplicateEntry= Duplicate path entries found ({0}), path: [{
CoreModel.PathEntry.NestedEntry= Nested path entries CoreModel.PathEntry.NestedEntry= Nested path entries
CoreModel.PathEntry.InvalidPathEntry= Invalid path CoreModel.PathEntry.InvalidPathEntry= Invalid path
CommandLauncher.error.commandCanceled=Command canceled
CCProjectNature.exception.noNature=Project must have a cnature CCProjectNature.exception.noNature=Project must have a cnature
CCorePlugin.exception.noBinaryFormat=No Binary Format CCorePlugin.exception.noBinaryFormat=No Binary Format

View file

@ -16,6 +16,8 @@ public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.core.messages"; //$NON-NLS-1$ private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.core.messages"; //$NON-NLS-1$
public static String Util_unexpectedError; public static String Util_unexpectedError;
public static String Addr_valueOutOfRange; public static String Addr_valueOutOfRange;
public static String CommandLauncher_CommandCancelled;
public static String CommandLauncher_ProgramNotFoundInPath;
public static String convention_illegalIdentifier; public static String convention_illegalIdentifier;
public static String convention_invalid; public static String convention_invalid;
public static String convention_reservedKeyword; public static String convention_reservedKeyword;

View file

@ -47,6 +47,8 @@ convention_enum_invalidName= Enum name is invalid
Util_unexpectedError=Unexpected error Util_unexpectedError=Unexpected error
Addr_valueOutOfRange=Address is outside valid range. Addr_valueOutOfRange=Address is outside valid range.
CommandLauncher_CommandCancelled=Command canceled
CommandLauncher_ProgramNotFoundInPath=Error: Program "{0}" not found in PATH
XmlUtil_InternalErrorLoading=Internal error while trying to load XML document XmlUtil_InternalErrorLoading=Internal error while trying to load XML document
XmlUtil_InternalErrorSerializing=Internal error while trying to serialize XML Document. XmlUtil_InternalErrorSerializing=Internal error while trying to serialize XML Document.

View file

@ -43,7 +43,6 @@ import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.handlers.IHandlerService; import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ILinkage;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.index.IIndex; import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.index.IIndexFile; import org.eclipse.cdt.core.index.IIndexFile;
@ -133,13 +132,11 @@ public class BaseUITestCase extends BaseTestCase {
continue; continue;
index.acquireReadLock(); index.acquireReadLock();
try { try {
IIndexFile pfile= index.getFile(ILinkage.CPP_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(file)); IIndexFile[] indexFiles= index.getFiles(IndexLocationFactory.getWorkspaceIFL(file));
if (pfile != null && pfile.getTimestamp() >= file.getLocalTimeStamp()) { for (IIndexFile indexFile : indexFiles) {
return; if (indexFile != null && indexFile.getTimestamp() >= file.getLocalTimeStamp()) {
} return;
pfile= index.getFile(ILinkage.C_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(file)); }
if (pfile != null && pfile.getTimestamp() >= file.getLocalTimeStamp()) {
return;
} }
} finally { } finally {
index.releaseReadLock(); index.releaseReadLock();

View file

@ -96,26 +96,26 @@ Export-Package: org.eclipse.cdt.internal.corext;x-internal:=true,
org.eclipse.cdt.ui.wizards, org.eclipse.cdt.ui.wizards,
org.eclipse.cdt.ui.wizards.conversion, org.eclipse.cdt.ui.wizards.conversion,
org.eclipse.cdt.utils.ui.controls org.eclipse.cdt.utils.ui.controls
Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.3.0,4.0.0)", Require-Bundle: org.eclipse.cdt.core;bundle-version="[5.2.0,6.0.0)",
org.eclipse.ui.views;bundle-version="[3.2.0,4.0.0)",
org.eclipse.jface.text;bundle-version="[3.4.0,4.0.0)",
org.eclipse.ui.workbench.texteditor;bundle-version="[3.5.0,4.0.0)",
org.eclipse.ui.editors;bundle-version="[3.3.0,4.0.0)",
org.eclipse.ui;bundle-version="[3.3.0,4.0.0)",
org.eclipse.ui.forms;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
org.eclipse.search;bundle-version="[3.2.0,4.0.0)",
org.eclipse.compare;bundle-version="[3.3.0,4.0.0)", org.eclipse.compare;bundle-version="[3.3.0,4.0.0)",
org.eclipse.cdt.core;bundle-version="[5.2.0,6.0.0)",
org.eclipse.ui.console;bundle-version="[3.1.100,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
org.eclipse.help;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.filesystem;bundle-version="[1.1.0,2.0.0)", org.eclipse.core.filesystem;bundle-version="[1.1.0,2.0.0)",
org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
org.eclipse.core.variables;bundle-version="[3.1.100,4.0.0)", org.eclipse.core.variables;bundle-version="[3.1.100,4.0.0)",
org.eclipse.help;bundle-version="[3.2.0,4.0.0)",
org.eclipse.jface.text;bundle-version="[3.4.0,4.0.0)",
org.eclipse.ltk.core.refactoring;bundle-version="3.4.0", org.eclipse.ltk.core.refactoring;bundle-version="3.4.0",
org.eclipse.ltk.ui.refactoring;bundle-version="3.4.0", org.eclipse.ltk.ui.refactoring;bundle-version="3.4.0",
org.eclipse.ui.navigator.resources;bundle-version="3.3.100" org.eclipse.search;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui;bundle-version="[3.3.0,4.0.0)",
org.eclipse.ui.console;bundle-version="[3.1.100,4.0.0)",
org.eclipse.ui.editors;bundle-version="[3.3.0,4.0.0)",
org.eclipse.ui.forms;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui.ide;bundle-version="[3.3.0,4.0.0)",
org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui.navigator.resources;bundle-version="3.3.100",
org.eclipse.ui.views;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui.workbench.texteditor;bundle-version="[3.5.0,4.0.0)",
com.ibm.icu;bundle-version="4.4.2"
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.ibm.icu.text