mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Added some missing types and methods for the type parsing.
This commit is contained in:
parent
6472982fc0
commit
af887aa72c
7 changed files with 193 additions and 2 deletions
|
@ -1,3 +1,13 @@
|
|||
2003-06-04 Mikhail Khodjaiants
|
||||
Added some missing types and methods for the type parsing.
|
||||
* src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java
|
||||
* src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayType.java
|
||||
* src/org/eclipse/cdt/debug/mi/core/cdi/model/type/DoubleValue.java
|
||||
* src/org/eclipse/cdt/debug/mi/core/cdi/model/type/FloatingPointValue.java
|
||||
* src/org/eclipse/cdt/debug/mi/core/cdi/model/type/FloatValue.java
|
||||
* src/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerValue.java: new
|
||||
* src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java: new
|
||||
|
||||
2003-06-03 Alain Magloire
|
||||
|
||||
* src/org/eclipse/cdt/debug/mi/core/GDBTypeParser.java:
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.eclipse.cdt.debug.core.cdi.model.type.ICDIIntType;
|
|||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongLongType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIShortType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIStructType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
|
||||
|
@ -41,6 +42,8 @@ import org.eclipse.cdt.debug.mi.core.cdi.model.type.IncompleteType;
|
|||
import org.eclipse.cdt.debug.mi.core.cdi.model.type.IntValue;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.type.LongLongValue;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.type.LongValue;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.type.PointerValue;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.type.ReferenceValue;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.type.ShortValue;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.type.Type;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.type.WCharValue;
|
||||
|
@ -171,8 +174,10 @@ public class Variable extends CObject implements ICDIVariable {
|
|||
value = new Value(this);
|
||||
} else if (t instanceof ICDIPointerType) {
|
||||
//((ICDIPointerType)t).getComponentType();
|
||||
//value = new PointerValue(this);
|
||||
value = new Value(this);
|
||||
value = new PointerValue(this);
|
||||
//value = new Value(this);
|
||||
} else if (t instanceof ICDIReferenceType) {
|
||||
value = new ReferenceValue(this);
|
||||
} else if (t instanceof ICDIArrayType) {
|
||||
//((ICDIArrayType)t).getComponentType();
|
||||
//value = new ArrayValue(this);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDoubleValue;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
|
||||
|
||||
|
@ -19,4 +20,20 @@ public class DoubleValue extends FloatingPointValue implements ICDIDoubleValue {
|
|||
super(v);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue#isNaN()
|
||||
*/
|
||||
public boolean isNaN() {
|
||||
// Identify this value as Not-a-Number if parsing fails.
|
||||
try {
|
||||
Double.parseDouble( getValueString() );
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
return true;
|
||||
}
|
||||
catch (CDIException e) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatValue;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
|
||||
|
||||
|
@ -19,4 +20,20 @@ public class FloatValue extends FloatingPointValue implements ICDIFloatValue {
|
|||
super(v);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue#isNaN()
|
||||
*/
|
||||
public boolean isNaN() {
|
||||
// Identify this value as Not-a-Number if parsing fails.
|
||||
try {
|
||||
Float.parseFloat( getValueString() );
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
return true;
|
||||
}
|
||||
catch (CDIException e) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Value;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
|
||||
|
@ -20,4 +21,58 @@ public abstract class FloatingPointValue extends Value implements ICDIFloatingPo
|
|||
super(v);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue#doubleValue()
|
||||
*/
|
||||
public double doubleValue() throws CDIException {
|
||||
double result = 0;
|
||||
try {
|
||||
result = Double.parseDouble( getValueString() );
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue#floatValue()
|
||||
*/
|
||||
public float floatValue() throws CDIException {
|
||||
float result = 0;
|
||||
try {
|
||||
result = Float.parseFloat( getValueString() );
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue#longValue()
|
||||
*/
|
||||
public long longValue() throws CDIException {
|
||||
Double dbl = new Double( doubleValue() );
|
||||
return dbl.longValue();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue#isInfinite()
|
||||
*/
|
||||
public boolean isInfinite() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue#isNaN()
|
||||
*/
|
||||
public boolean isNaN() {
|
||||
String valueString = null;
|
||||
try {
|
||||
valueString = getValueString();
|
||||
}
|
||||
catch (CDIException e) {
|
||||
}
|
||||
return ( valueString != null ) ? valueString.indexOf( "nan" ) != -1 : false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Value;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
|
||||
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since Jun 3, 2003
|
||||
*/
|
||||
public class PointerValue extends Value implements ICDIPointerValue {
|
||||
|
||||
public PointerValue(Variable v) {
|
||||
super(v);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue#pointerValue()
|
||||
*/
|
||||
public long pointerValue() throws CDIException {
|
||||
long value = 0;
|
||||
String valueString = getValueString();
|
||||
int space = valueString.indexOf(' ');
|
||||
if (space != -1) {
|
||||
valueString = valueString.substring(0, space).trim();
|
||||
}
|
||||
try {
|
||||
value = Long.decode(valueString).longValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Value;
|
||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
|
||||
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since Jun 3, 2003
|
||||
*/
|
||||
public class ReferenceValue extends Value implements ICDIReferenceValue {
|
||||
|
||||
/**
|
||||
* @param v
|
||||
*/
|
||||
public ReferenceValue(Variable v) {
|
||||
super(v);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue#referenceValue()
|
||||
*/
|
||||
public long referenceValue() throws CDIException {
|
||||
long value = 0;
|
||||
String valueString = getValueString().trim();
|
||||
if ( valueString.startsWith( "@" ) )
|
||||
valueString = valueString.substring( 1 );
|
||||
int space = valueString.indexOf(' ');
|
||||
if (space != -1) {
|
||||
valueString = valueString.substring(0, space).trim();
|
||||
}
|
||||
try {
|
||||
value = Long.decode(valueString).longValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue