From 687276bccd448b5397f4410bb10894fbf39be527 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Sun, 22 Aug 2021 22:47:48 -0300 Subject: [PATCH] Adds support to STRING elements in UDTs. --- internal/support/vwatch/vwatch.bm | 4 ++-- source/ide/ide_methods.bas | 16 +++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/internal/support/vwatch/vwatch.bm b/internal/support/vwatch/vwatch.bm index c6646a601..3c1a3ad30 100644 --- a/internal/support/vwatch/vwatch.bm +++ b/internal/support/vwatch/vwatch.bm @@ -322,10 +322,10 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET) vw_m2 = _MEM(_OFFSET(vw_buf$), vw_varSize) _MEMCOPY vw_m, vw_m.OFFSET, vw_m.SIZE TO vw_m2, vw_m2.OFFSET - IF INSTR(vw_varType$, "STRING *") > 0 AND vw_isarray <> 0 THEN + IF INSTR(vw_varType$, "STRING *") > 0 AND (vw_isarray <> 0 OR vw_elementoffset > 0) THEN 'actual data already fetched; nothing else to do ELSEIF INSTR(vw_varType$, "STRING") THEN - IF vw_isarray THEN + IF vw_isarray <> 0 OR vw_elementoffset > 0 THEN 'First pass vw_varSize = LEN(vw_dummy%&) vw_buf$ = SPACE$(vw_varSize) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 06ae1670d..a72d2d4a5 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -7396,7 +7396,7 @@ SUB DebugMode END IF GOSUB GetVarSize IF LEN(cmd$) THEN - cmd$ = cmd$ + MKL$(tempIndex&) + _MK$(_BYTE, usedVariableList(tempIndex&).isarray) + MKL$(usedVariableList(tempIndex&).localIndex) + MKL$(tempArrayIndex&) + _MK$(_OFFSET, usedVariableList(tempIndex&).elementOffset) + MKL$(varSize&) + MKI$(LEN(usedVariableList(tempIndex&).subfunc)) + usedVariableList(tempIndex&).subfunc + MKI$(LEN(usedVariableList(tempIndex&).varType)) + usedVariableList(tempIndex&).varType + cmd$ = cmd$ + MKL$(tempIndex&) + _MK$(_BYTE, usedVariableList(tempIndex&).isarray) + MKL$(usedVariableList(tempIndex&).localIndex) + MKL$(tempArrayIndex&) + _MK$(_OFFSET, usedVariableList(tempIndex&).elementOffset) + MKL$(varSize&) + MKI$(LEN(usedVariableList(tempIndex&).subfunc)) + usedVariableList(tempIndex&).subfunc + MKI$(LEN(varType$)) + varType$ GOSUB SendCommand END IF LOOP @@ -7585,9 +7585,10 @@ SUB DebugMode GetVarSize: varSize& = 0 varType$ = usedVariableList(tempIndex&).varType - IF INSTR(varType$, "STRING *") THEN varType$ = "STRING" checkVarType: - SELECT CASE varType$ + tempVarType$ = varType$ + IF INSTR(tempVarType$, "STRING *") THEN tempVarType$ = "STRING" + SELECT CASE tempVarType$ CASE "_BYTE", "_UNSIGNED _BYTE", "BYTE", "UNSIGNED BYTE": varSize& = LEN(dummy%%) CASE "INTEGER", "_UNSIGNED INTEGER", "UNSIGNED INTEGER": varSize& = LEN(dummy%) CASE "LONG", "_UNSIGNED LONG", "UNSIGNED LONG": varSize& = LEN(dummy&) @@ -8134,12 +8135,17 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar, returnAction) usedVariableList(varDlgList(y).index).elementTypes = "_UNSIGNED _OFFSET" CASE ELSE IF typ AND ISSTRING THEN - usedVariableList(varDlgList(y).index).elementTypes = "STRING" + IF (typ AND ISFIXEDLENGTH) = 0 THEN + usedVariableList(varDlgList(y).index).elementTypes = "STRING" + ELSE + 'E contains the UDT element index at this point + usedVariableList(varDlgList(y).index).elementTypes = "STRING *" + STR$(udtetypesize(E)) + END IF ELSE usedVariableList(varDlgList(y).index).watch = 0 usedVariableList(varDlgList(y).index).elements = "" usedVariableList(varDlgList(y).index).elementOffset = 0 - result = idemessagebox("Error", "Element must be of a native data type", "#OK") + result = idemessagebox("Error", "Cannot add full UDT to Watch List", "#OK") GOTO unWatch END IF END SELECT