diff --git a/app/src/gambas3/.lang/.pot b/app/src/gambas3/.lang/.pot index afecfdc4d..c6e2c1b46 100644 --- a/app/src/gambas3/.lang/.pot +++ b/app/src/gambas3/.lang/.pot @@ -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 "" diff --git a/app/src/gambas3/.src/Debug/FDebugExpr.class b/app/src/gambas3/.src/Debug/FDebugExpr.class index 95ae8f10d..4a32a5437 100644 --- a/app/src/gambas3/.src/Debug/FDebugExpr.class +++ b/app/src/gambas3/.src/Debug/FDebugExpr.class @@ -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 diff --git a/main/gbx/gbx_api.c b/main/gbx/gbx_api.c index 4c39e2483..5f214c329 100644 --- a/main/gbx/gbx_api.c +++ b/main/gbx/gbx_api.c @@ -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 }; diff --git a/main/gbx/gbx_c_array.c b/main/gbx/gbx_c_array.c index 384551e8b..809137add 100644 --- a/main/gbx/gbx_c_array.c +++ b/main/gbx/gbx_c_array.c @@ -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) diff --git a/main/gbx/gbx_c_array.h b/main/gbx/gbx_c_array.h index 80fe2e10c..d3db2976a 100644 --- a/main/gbx/gbx_c_array.h +++ b/main/gbx/gbx_c_array.h @@ -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); diff --git a/main/lib/debug/gb.debug.h b/main/lib/debug/gb.debug.h index dcf4620e2..e43039f0d 100644 --- a/main/lib/debug/gb.debug.h +++ b/main/lib/debug/gb.debug.h @@ -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; diff --git a/main/lib/debug/print.c b/main/lib/debug/print.c index 4a852ec05..d7ba3b74e 100644 --- a/main/lib/debug/print.c +++ b/main/lib/debug/print.c @@ -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; }