1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-06-29 09:20:38 +00:00

Adds support to STRING elements in UDTs.

This commit is contained in:
FellippeHeitor 2021-08-22 22:47:48 -03:00
parent bf9ab3458c
commit 687276bccd
2 changed files with 13 additions and 7 deletions

View file

@ -322,10 +322,10 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET)
vw_m2 = _MEM(_OFFSET(vw_buf$), vw_varSize) vw_m2 = _MEM(_OFFSET(vw_buf$), vw_varSize)
_MEMCOPY vw_m, vw_m.OFFSET, vw_m.SIZE TO vw_m2, vw_m2.OFFSET _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 'actual data already fetched; nothing else to do
ELSEIF INSTR(vw_varType$, "STRING") THEN ELSEIF INSTR(vw_varType$, "STRING") THEN
IF vw_isarray THEN IF vw_isarray <> 0 OR vw_elementoffset > 0 THEN
'First pass 'First pass
vw_varSize = LEN(vw_dummy%&) vw_varSize = LEN(vw_dummy%&)
vw_buf$ = SPACE$(vw_varSize) vw_buf$ = SPACE$(vw_varSize)

View file

@ -7396,7 +7396,7 @@ SUB DebugMode
END IF END IF
GOSUB GetVarSize GOSUB GetVarSize
IF LEN(cmd$) THEN 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 GOSUB SendCommand
END IF END IF
LOOP LOOP
@ -7585,9 +7585,10 @@ SUB DebugMode
GetVarSize: GetVarSize:
varSize& = 0 varSize& = 0
varType$ = usedVariableList(tempIndex&).varType varType$ = usedVariableList(tempIndex&).varType
IF INSTR(varType$, "STRING *") THEN varType$ = "STRING"
checkVarType: 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 "_BYTE", "_UNSIGNED _BYTE", "BYTE", "UNSIGNED BYTE": varSize& = LEN(dummy%%)
CASE "INTEGER", "_UNSIGNED INTEGER", "UNSIGNED INTEGER": varSize& = LEN(dummy%) CASE "INTEGER", "_UNSIGNED INTEGER", "UNSIGNED INTEGER": varSize& = LEN(dummy%)
CASE "LONG", "_UNSIGNED LONG", "UNSIGNED LONG": 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" usedVariableList(varDlgList(y).index).elementTypes = "_UNSIGNED _OFFSET"
CASE ELSE CASE ELSE
IF typ AND ISSTRING THEN 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 ELSE
usedVariableList(varDlgList(y).index).watch = 0 usedVariableList(varDlgList(y).index).watch = 0
usedVariableList(varDlgList(y).index).elements = "" usedVariableList(varDlgList(y).index).elements = ""
usedVariableList(varDlgList(y).index).elementOffset = 0 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 GOTO unWatch
END IF END IF
END SELECT END SELECT