[DEVELOPMENT ENVIRONMENT]

* BUG: Support for multi-dimensional arrays in the debugger.

[INTERPRETER]
* BUG: Support for multi-dimensional arrays in the debugger.

[GB.DEBUG]
* BUG: Support for structures.
* BUG: Support for multi-dimensional arrays in the debugger.


git-svn-id: svn://localhost/gambas/trunk@3654 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2011-03-16 22:16:19 +00:00
parent a4d3dfeab8
commit dc5f2a344b
7 changed files with 86 additions and 13 deletions

View File

@ -672,7 +672,7 @@ msgstr ""
msgid "Default value"
msgstr ""
#: FConnectionEditor.class:58 FDebugExpr.class:422 FHelpBrowser.class:321
#: FConnectionEditor.class:58 FDebugExpr.class:463 FHelpBrowser.class:321
msgid "Index"
msgstr ""
@ -1116,23 +1116,23 @@ msgstr ""
msgid "not available"
msgstr ""
#: FDebugExpr.class:424 FDebugInfo.class:30 FPropertyProject.class:130
#: FDebugExpr.class:465 FDebugInfo.class:30 FPropertyProject.class:130
msgid "Value"
msgstr ""
#: FDebugExpr.class:428
#: FDebugExpr.class:469
msgid "Key"
msgstr ""
#: FDebugExpr.class:434
#: FDebugExpr.class:475
msgid "Symbol"
msgstr ""
#: FDebugExpr.class:776
#: FDebugExpr.class:817
msgid "Show hidden symbols"
msgstr ""
#: FDebugExpr.class:793
#: FDebugExpr.class:834
msgid "No element"
msgstr ""

View File

@ -22,6 +22,7 @@ Private $sClass As String
Private $sRealClass As String
Private $bArray As Boolean
Private $bCollection As Boolean
Private $aDim As Integer[]
Static Public Sub Add(sExpr As String, sInfo As String)
@ -90,6 +91,30 @@ Public Sub _new(sExpr As String, sInfo As String)
End
Private Sub GetIndiceFromRow(iRow As Integer) As String
Dim sSym As String
Dim iDim As Integer
If $aDim Then
For Each iDim In $aDim
sSym = CStr(iRow Mod iDim) & ", " & sSym
iRow \= iDim
Next
sSym = Left(sSym, -2)
Else
sSym = CStr(iRow)
Endif
Return sSym
End
Public Sub gvwExpr_Data(Row As Integer, Column As Integer)
Dim sSym As String
@ -98,16 +123,18 @@ Public Sub gvwExpr_Data(Row As Integer, Column As Integer)
If Column = 0 Then gvwExpr.Data.Foreground = Color.Merge(Color.TextBackground, Color.TextForeground, 0.7)
If $bArray Then
sSym = GetIndiceFromRow(Row)
If Column = 0 Then
gvwExpr.Data.Text = Row
gvwExpr.Data.Text = sSym
Else
sVal = $cVal[Row]
If sVal Then
gvwExpr.Data.Text = sVal
'$cVal.Remove(Row)
Else
Design.Command("?X" & $sExpr & "#" & CStr(Row) & "\t" & $sExpr & "[" & Row & "]")
Design.Command("?X" & $sExpr & "#" & CStr(Row) & "\t" & $sExpr & "[" & sSym & "]")
Endif
Endif
@ -286,6 +313,7 @@ Private Sub Init(sInfo As String, bNew As Boolean) As Boolean
Dim sType As String
Dim iCol As Integer
Dim nRow As Integer
Dim iSize As Integer
Dim nRowAsArray As Integer = -1
Dim bShowHidden As Boolean = btnHidden.Value
Dim bHasHidden As Boolean
@ -315,7 +343,20 @@ Private Sub Init(sInfo As String, bNew As Boolean) As Boolean
$bCollection = False
$bArray = True
nRow = Val(Mid$($aSym[0], 2, -1))
sSym = Mid$($aSym[0], 2, -1)
If InStr(sSym, ",") Then
nRow = 1
$aDim = New Integer[]
For Each sSym In Split(sSym, ",")
iSize = CInt(sSym)
$aDim.Add(iSize)
nRow *= iSize
Next
Else
nRow = CInt(sSym)
$aDim = Null
Endif
Else
@ -713,7 +754,7 @@ Public Sub gvwExpr_Save(Row As Integer, Column As Integer, Value As String)
If $bArray Then
$cVal[Row] = Null
Design.Command("=X" & $sExpr & "#" & CStr(Row) & "\t" & $sExpr & "[" & Row & "] = " & Value)
Design.Command("=X" & $sExpr & "#" & CStr(Row) & "\t" & $sExpr & "[" & GetIndiceFromRow(Row) & "] = " & Value)
Else If $bCollection Then

View File

@ -277,6 +277,7 @@ void *GAMBAS_DebugApi[] =
(void *)CLASS_get_next_sorted_symbol,
(void *)DEBUG_get_object_access_type,
(void *)DEBUG_find_class,
(void *)CARRAY_get_array_bounds,
NULL
};

View File

@ -425,6 +425,11 @@ void CARRAY_get_value(CARRAY *_object, int index, VALUE *value)
VALUE_read(value, get_data(THIS, index), THIS->type);
}
int *CARRAY_get_array_bounds(CARRAY *_object)
{
return THIS->dim;
}
BEGIN_METHOD(CARRAY_new, GB_INTEGER size)

View File

@ -74,6 +74,7 @@ void CARRAY_get_value(CARRAY *_object, int index, VALUE *value);
void *CARRAY_get_data_multi(CARRAY *_object, GB_INTEGER *arg, int nparam);
void *CARRAY_out_of_bound();
CLASS *CARRAY_get_array_class(CLASS *class, CTYPE ctype);
int *CARRAY_get_array_bounds(CARRAY *_object);
CARRAY *CARRAY_create_static(CLASS *class, void *ref, CLASS_ARRAY *desc, void *data);
int CARRAY_get_static_count(CLASS_ARRAY *desc);

View File

@ -75,6 +75,7 @@ typedef
void *(*GetNextSortedSymbol)(void *klass, int *index);
int (*GetObjectAccessType)(void *object, CLASS *klass, int *count);
GB_CLASS (*FindClass)(const char *name);
int *(*GetArrayBounds)(void *array);
}
GB_DEBUG_INTERFACE;

View File

@ -325,6 +325,7 @@ void PRINT_object(FILE *where, VALUE *value)
int len;
bool static_class;
int access;
int *dim;
_where = where;
@ -400,8 +401,30 @@ void PRINT_object(FILE *where, VALUE *value)
access = GB_DEBUG.GetObjectAccessType(object, class, &count);
//if (GB.Is(object, GB.FindClass("Array")))
if (access == GB_DEBUG_ACCESS_ARRAY)
if (GB.Is(object, GB.FindClass("Array")))
{
dim = GB_DEBUG.GetArrayBounds(object);
if (!dim)
fprintf(_where, "A [%d]", count);
else
{
fprintf(_where, "A [");
for(;;)
{
len = *dim++;
if (len > 0)
fprintf(_where, "%d,", len);
else
{
fprintf(_where, "%d", -len);
break;
}
}
fprintf(_where, "]");
}
return;
}
else if (access == GB_DEBUG_ACCESS_ARRAY)
{
fprintf(_where, "A [%d]", count);
return;
@ -457,6 +480,7 @@ void PRINT_object(FILE *where, VALUE *value)
case CD_VARIABLE:
case CD_PROPERTY:
case CD_PROPERTY_READ:
case CD_STRUCT_FIELD:
fprintf(_where, " %.*s", cd->len, key);
break;
}