diff --git a/internal/c/qbx.cpp b/internal/c/qbx.cpp index 08062bc35..742c07e50 100755 --- a/internal/c/qbx.cpp +++ b/internal/c/qbx.cpp @@ -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 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 - vw_address = vw_address + (vw_realArrayIndex * vw_arrayElementSize) + '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 END IF @@ -490,11 +515,25 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET) vw_varSize = LEN(vw_dummy%&) END IF - '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) + 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 - vw_address = vw_address + (vw_realArrayIndex * vw_arrayElementSize) + '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 @@ -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) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 007b14c9d..d03b2ceab 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -8496,14 +8496,14 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar, returnAction) GOTO getNewValueInput END SELECT END IF - END IF - IF INSTR(varType$, "STRING") = 0 AND thisReturnAction <> 3 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") - _KEYCLEAR - GOTO getNewValueInput + 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") + _KEYCLEAR + GOTO getNewValueInput + END IF END IF END IF diff --git a/source/qb64.bas b/source/qb64.bas index 4d193901b..6f9236aeb 100644 --- a/source/qb64.bas +++ b/source/qb64.bas @@ -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)