1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 06:45:43 +02:00

Formatting 'char' types.

This commit is contained in:
Mikhail Khodjaiants 2002-12-17 21:54:18 +00:00
parent 427def3fc0
commit 0f09d718fc
5 changed files with 24 additions and 7 deletions

View file

@ -1,3 +1,8 @@
2002-12-17 Mikhail Khodjaiants
Formatting 'char' types.
* CValue.java
* CModificationVariable.java
2002-12-17 Mikhail Khodjaiants
The core support of the prompting source locator.
* ICSourceLocator.java

View file

@ -9,6 +9,7 @@ package org.eclipse.cdt.debug.internal.core.model;
import java.text.MessageFormat;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIFormat;
import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
import org.eclipse.cdt.debug.core.model.ICValue;
@ -139,7 +140,7 @@ public abstract class CModificationVariable extends CVariable
requestFailed( "Unable to set value.", null );
return null;
}
if ( value.getType() == ICValue.TYPE_CHAR )
if ( value.getType() == ICValue.TYPE_CHAR && getFormat() == ICDIFormat.NATURAL )
{
char[] chars = oldExpression.toCharArray();
if ( chars.length != 1 )

View file

@ -289,27 +289,33 @@ public class CValue extends CDebugElement implements ICValue
private String getCharValue( String value )
{
char result = '.';
String result = "";
int index = value.indexOf( ' ' );
if ( index > 0 )
{
char resultChar = '.';
try
{
short shortValue = Short.parseShort( value.substring( 0, index ), 10 );
if ( shortValue >= 0 )
{
result = (char)shortValue;
if ( Character.isISOControl( result ) )
resultChar = (char)shortValue;
if ( Character.isISOControl( resultChar ) )
{
result = '.';
resultChar = '.';
}
}
}
catch( NumberFormatException e )
{
}
result = String.valueOf( resultChar );
}
return String.valueOf( result );
else
{
result = value;
}
return result;
}
protected CVariable getParentVariable()

View file

@ -1,3 +1,7 @@
2002-12-17 Mikhail Khodjaiants
Formatting 'char' types.
* VariableFormatActionDelegate.java
2002-12-17 Mikhail Khodjaiants
Removed the "Primitive type display options" section from the C/C++ Debug preference page because of the different formattong strategy.
* CDebugPreferencePage.java

View file

@ -122,9 +122,10 @@ public class VariableFormatActionDelegate implements IObjectActionDelegate
{
switch( ((ICValue)value).getType() )
{
case ICValue.TYPE_ARRAY:
// case ICValue.TYPE_ARRAY:
case ICValue.TYPE_SIMPLE:
case ICValue.TYPE_POINTER:
case ICValue.TYPE_CHAR:
enabled = true;
break;
}