mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-28 11:17:46 +00:00
Fixes watching/sending values for _BIT arrays.
This commit is contained in:
parent
f6f8a254a7
commit
3e498df414
4 changed files with 68 additions and 18 deletions
|
@ -949,6 +949,18 @@ ptrszint check_ubound(ptrszint *array,int32 index, int32 num_indexes) {
|
|||
return func_ubound((ptrszint*)(*array),index,num_indexes);
|
||||
}
|
||||
|
||||
uint64 call_getubits(uint32 bsize,ptrszint *array,ptrszint i) {
|
||||
return getubits(bsize,(uint8*)(*array),i);
|
||||
}
|
||||
|
||||
int64 call_getbits(uint32 bsize,ptrszint *array,ptrszint i) {
|
||||
return getbits(bsize,(uint8*)(*array),i);
|
||||
}
|
||||
|
||||
void call_setbits(uint32 bsize,ptrszint *array,ptrszint i,int64 val) {
|
||||
setbits(bsize,(uint8*)(*array),i,val);
|
||||
}
|
||||
|
||||
inline ptrszint array_check(uptrszint index,uptrszint limit){
|
||||
//nb. forces signed index into an unsigned variable for quicker comparison
|
||||
if (index<limit) return index;
|
||||
|
|
|
@ -9,21 +9,26 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET)
|
|||
DIM AS LONG vw_i, vw_j, vw_tempIndex, vw_localIndex, vw_varSize, vw_cmdSize
|
||||
DIM AS LONG vw_arrayElementSize, vw_element, vw_elementOffset, vw_storage, vw_blockSize
|
||||
DIM AS LONG vw_arrayDimension, vw_arrayTotalDimensions, vw_arrayIndex, vw_realArrayIndex
|
||||
DIM AS LONG vw_wpi, vw_wpj
|
||||
DIM AS _INTEGER64 vw_tempBitValue
|
||||
DIM AS _OFFSET vw_address, vw_lBound, vw_uBound
|
||||
DIM AS _MEM vw_m, vw_m2
|
||||
DIM AS _BYTE vw_isArray, vw_isUDT, vw_checkingWatchpoints
|
||||
DIM vw_start!, vw_temp$, vw_cmd$, vw_value$, vw_k&, vw_buf$, vw_scope$, vw_varType$
|
||||
DIM vw_getBytes&, vw_getBytesPosition&, vw_valueBytes$, vw_dummy%&
|
||||
DIM vw_arrayIndexes$, vw_wpExpression$
|
||||
DIM vw_arrayIndexes$, vw_wpExpression$, vw_wpTemp$, vw_v1$, vw_v2$
|
||||
|
||||
DECLARE LIBRARY
|
||||
SUB vwatch_stoptimers ALIAS stop_timers
|
||||
SUB vwatch_starttimers ALIAS start_timers
|
||||
SUB unlockvWatchHandle
|
||||
SUB set_qbs_size (target AS _OFFSET, BYVAL length&)
|
||||
SUB call_setbits (BYVAL bsize AS _UNSIGNED LONG, array AS _OFFSET, BYVAL index AS _OFFSET, BYVAL value AS _INTEGER64)
|
||||
FUNCTION stop_program_state&
|
||||
FUNCTION check_lbound%& (array AS _OFFSET, BYVAL index AS LONG, BYVAL num_indexes AS LONG)
|
||||
FUNCTION check_ubound%& (array AS _OFFSET, BYVAL index AS LONG, BYVAL num_indexes AS LONG)
|
||||
FUNCTION call_getubits~&& (BYVAL bsize AS _UNSIGNED LONG, array AS _OFFSET, BYVAL index AS _OFFSET)
|
||||
FUNCTION call_getbits&& (BYVAL bsize AS _UNSIGNED LONG, array AS _OFFSET, BYVAL index AS _OFFSET)
|
||||
END DECLARE
|
||||
|
||||
$IF WIN THEN
|
||||
|
@ -357,6 +362,25 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET)
|
|||
ELSEIF vw_varType$ = "STRING" THEN
|
||||
vw_varSize = LEN(vw_dummy%&)
|
||||
END IF
|
||||
|
||||
IF INSTR(vw_varType$, "BIT") THEN
|
||||
vw_i = INSTR(vw_varType$, "*")
|
||||
IF vw_i > 0 THEN
|
||||
vw_i = VAL(MID$(vw_varType$, vw_i + 1))
|
||||
ELSE
|
||||
vw_i = 1
|
||||
END IF
|
||||
IF INSTR(vw_varType$, "UNSIGNED") THEN
|
||||
vw_buf$ = _MK$(_UNSIGNED _INTEGER64, call_getubits~&&(vw_i, vw_address, vw_realArrayIndex))
|
||||
ELSE
|
||||
vw_buf$ = _MK$(_UNSIGNED _INTEGER64, call_getbits&&(vw_i, vw_address, vw_realArrayIndex))
|
||||
END IF
|
||||
|
||||
IF vw_checkingWatchpoints THEN RETURN
|
||||
vw_cmd$ = "address read:" + MKL$(vw_tempIndex) + MKL$(vw_arrayIndex) + MKL$(vw_element) + MKL$(vw_storage) + vw_buf$
|
||||
GOSUB SendCommand
|
||||
GOTO cmdProcessingDone
|
||||
ELSE
|
||||
'this is where we calculate the actual array index position in memory
|
||||
IF vw_arrayElementSize = 0 THEN
|
||||
vw_address = vw_address + (vw_realArrayIndex * vw_varSize)
|
||||
|
@ -364,6 +388,7 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET)
|
|||
vw_address = vw_address + (vw_realArrayIndex * vw_arrayElementSize)
|
||||
END IF
|
||||
END IF
|
||||
END IF
|
||||
|
||||
'vw_address now points to the actual data
|
||||
vw_address = vw_address + vw_elementOffset
|
||||
|
@ -490,12 +515,26 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET)
|
|||
vw_varSize = LEN(vw_dummy%&)
|
||||
END IF
|
||||
|
||||
IF INSTR(vw_varType$, "BIT") THEN
|
||||
vw_i = INSTR(vw_varType$, "*")
|
||||
IF vw_i > 0 THEN
|
||||
vw_i = VAL(MID$(vw_varType$, vw_i + 1))
|
||||
ELSE
|
||||
vw_i = 1
|
||||
END IF
|
||||
vw_buf$ = vw_value$ + STRING$(4, 0) 'pad with zeros in case a LONG was sent
|
||||
GOSUB GetV2
|
||||
vw_tempBitValue = VAL(vw_v2$)
|
||||
call_setbits vw_i, vw_address, vw_realArrayIndex, vw_tempBitValue
|
||||
GOTO cmdProcessingDone
|
||||
ELSE
|
||||
'this is where we calculate the actual array index position in memory
|
||||
IF vw_arrayElementSize = 0 THEN
|
||||
vw_address = vw_address + (vw_realArrayIndex * vw_varSize)
|
||||
ELSE
|
||||
vw_address = vw_address + (vw_realArrayIndex * vw_arrayElementSize)
|
||||
END IF
|
||||
END IF
|
||||
ELSE
|
||||
IF vw_isUDT = 0 THEN
|
||||
IF INSTR(vw_varType$, "STRING") = 0 THEN
|
||||
|
@ -700,8 +739,6 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET)
|
|||
RETURN
|
||||
|
||||
CheckWatchpoints:
|
||||
DIM AS LONG vw_wpi, vw_wpj
|
||||
DIM vw_wpTemp$, vw_v1$, vw_v2$
|
||||
FOR vw_wpi = 1 TO 2
|
||||
IF vw_wpi = 1 AND LEN(vw_globalWatchpoints$) > 0 THEN
|
||||
vw_wpTemp$ = MID$(vw_globalWatchpoints$, 5)
|
||||
|
|
|
@ -8496,9 +8496,8 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar, returnAction)
|
|||
GOTO getNewValueInput
|
||||
END SELECT
|
||||
END IF
|
||||
END IF
|
||||
|
||||
IF INSTR(varType$, "STRING") = 0 AND thisReturnAction <> 3 THEN
|
||||
IF INSTR(varType$, "STRING") = 0 THEN
|
||||
v$ = op$ + actualValue$
|
||||
IF v$ <> op$ + LTRIM$(STR$(VAL(actualValue$))) THEN
|
||||
result = idemessagebox(dlgTitle$, "Invalid expression.\nYou can use =, <>, >, >=, <, <=, and a literal value\n(scientific notation not allowed).", "#OK")
|
||||
|
@ -8506,6 +8505,7 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar, returnAction)
|
|||
GOTO getNewValueInput
|
||||
END IF
|
||||
END IF
|
||||
END IF
|
||||
|
||||
cmd$ = ""
|
||||
cmd$ = cmd$ + MKL$(tempIndex&)
|
||||
|
|
|
@ -14828,6 +14828,7 @@ FUNCTION dim2 (varname$, typ2$, method, elements$)
|
|||
|
||||
'array of bit-length variables
|
||||
IF elements$ <> "" THEN
|
||||
IF bits > 63 THEN Give_Error "Cannot create a bit array of size > 63 bits": EXIT FUNCTION
|
||||
arraydesc = 0
|
||||
cmps$ = varname$: IF unsgn THEN cmps$ = cmps$ + "~"
|
||||
cmps$ = cmps$ + "`" + str2(bits)
|
||||
|
|
Loading…
Reference in a new issue