From 883cfcb525fc86bd57e8b5cbfea86b39675d20f7 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Sat, 11 Sep 2021 18:23:31 -0300 Subject: [PATCH 1/5] Display warning when $Checking:Off is used with $Debug --- source/ide/ide_methods.bas | 4 ++-- source/qb64.bas | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 8c4ef0b18..91e701799 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -13038,7 +13038,7 @@ FUNCTION idewarningbox FOR x = 1 TO warningListItems IF warningLines(x) = 0 THEN l$ = l$ + warning$(x) - IF x > 1 THEN ASC(l$, treeConnection) = 192 + IF x > 1 AND treeConnection > 0 THEN ASC(l$, treeConnection) = 192 ELSE l3$ = CHR$(16) + CHR$(2) 'dark grey IF warningIncLines(x) > 0 THEN @@ -13052,7 +13052,7 @@ FUNCTION idewarningbox END IF treeConnection = LEN(l$) + 1 text$ = warning$(x) - IF LEN(text$) + 10 > dialogWidth THEN dialogWidth = LEN(text$) + 10 + IF LEN(l3$ + text$) + 6 > dialogWidth THEN dialogWidth = LEN(l3$ + text$) + 6 IF LEN(text$) THEN l$ = l$ + CHR$(195) + CHR$(196) + l3$ + ": " + text$ ELSE diff --git a/source/qb64.bas b/source/qb64.bas index b2d78418c..c830c0816 100644 --- a/source/qb64.bas +++ b/source/qb64.bas @@ -1683,8 +1683,6 @@ DO LOOP InValidLine(linenumber) = 0 - ColorPass: - IF LEN(wholeline$) THEN IF UCASE$(_TRIM$(wholeline$)) = "$NOPREFIX" THEN @@ -3130,12 +3128,18 @@ DO IF a3u$ = "$DEBUG" THEN layout$ = SCase$("$Debug") + IF NoIDEMode THEN + addWarning linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), "$Debug", "$Debug features only work from the IDE" + END IF GOTO finishednonexec END IF IF a3u$ = "$CHECKING:OFF" THEN layout$ = SCase$("$Checking:Off") NoChecks = 1 + IF vWatchOn <> 0 AND NoIDEMode = 0 AND inclevel = 0 THEN + addWarning linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), "$Debug", "$Debug features won't work in $Checking:Off blocks" + END IF GOTO finishednonexec END IF @@ -8781,13 +8785,13 @@ DO IF firstelement$ = "CHAIN" THEN IF vWatchOn THEN - addWarning linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), "Feature incompatible with $DEBUG MODE", "CHAIN" + addWarning linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), "Feature incompatible with $Debug mode", "CHAIN" END IF END IF IF firstelement$ = "RUN" THEN 'RUN IF vWatchOn THEN - addWarning linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), "Feature incompatible with $DEBUG MODE", "RUN" + addWarning linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), "Feature incompatible with $Debug mode", "RUN" END IF l$ = SCase$("Run") IF n = 1 THEN From 9a963b70f83b171013b826335983a4ebc207d292 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Sat, 11 Sep 2021 20:05:04 -0300 Subject: [PATCH 2/5] Fixes `doubleClickThreshold` in Watch List dialog. --- source/ide/ide_methods.bas | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 91e701799..fd667634d 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -7941,7 +7941,7 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar, returnAction) COLOR 0, 7 LOCATE p.y + 4, p.x + 2 PRINT "Double-click on an item to add it to the watch list:" - IF doubleClickThreshold < p.w AND IdeDebugMode > 0 THEN + IF doubleClickThreshold > 0 AND doubleClickThreshold < p.w AND IdeDebugMode > 0 THEN _PRINTSTRING (p.x + doubleClickThreshold, p.y + 5), CHR$(194) _PRINTSTRING (p.x + doubleClickThreshold, p.y + p.h - 1), CHR$(193) END IF @@ -8361,10 +8361,10 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar, returnAction) IF mCLICK AND focus = 2 THEN 'list click IF timeElapsedSince(lastClick!) < .3 AND clickedItem = o(varListBox).sel THEN - IF mX < p.x + doubleClickThreshold OR IdeDebugMode = 0 THEN - GOTO toggleWatch - ELSE + IF doubleClickThreshold > 0 AND mX >= p.x + doubleClickThreshold AND IdeDebugMode > 0 THEN GOTO sendValue + ELSE + GOTO toggleWatch END IF END IF lastClick! = TIMER From 619a8fb603ba48c4df27e0a2495e143b2bf511ab Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Sat, 11 Sep 2021 23:03:11 -0300 Subject: [PATCH 3/5] Highlights line number with execution pointer ($debug). --- source/ide/ide_methods.bas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index fd667634d..ee6ca67e0 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -12223,9 +12223,9 @@ SUB ideshowtext IF ShowLineNumbers THEN IF ShowLineNumbersUseBG THEN COLOR , 6 - IF searchStringFoundOn > 0 AND searchStringFoundOn = l THEN + IF (searchStringFoundOn > 0 AND searchStringFoundOn = l) OR (l = debugnextline AND vWatchOn = 1) THEN COLOR 13, 5 - searchStringFoundOn = 0 + IF searchStringFoundOn > 0 AND searchStringFoundOn = l THEN searchStringFoundOn = 0 END IF IF vWatchOn = 1 AND IdeBreakpoints(l) <> 0 THEN COLOR , 4 IF vWatchOn = 1 AND IdeSkipLines(l) <> 0 THEN COLOR 14 From 27c84393ec8ff537163e27ccb6d54076e672b81f Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Sat, 11 Sep 2021 23:05:26 -0300 Subject: [PATCH 4/5] Allows variables up to `_BIT * 64` --- source/qb64.bas | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/source/qb64.bas b/source/qb64.bas index c830c0816..a4d79c61b 100644 --- a/source/qb64.bas +++ b/source/qb64.bas @@ -825,8 +825,8 @@ DIM SHARED uniquenumbern AS LONG 'CLEAR , , 16384 -DIM SHARED bitmask(1 TO 56) AS _INTEGER64 -DIM SHARED bitmaskinv(1 TO 56) AS _INTEGER64 +DIM SHARED bitmask(1 TO 64) AS _INTEGER64 +DIM SHARED bitmaskinv(1 TO 64) AS _INTEGER64 DIM SHARED defineextaz(1 TO 27) AS STRING DIM SHARED defineaz(1 TO 27) AS STRING '27 is an underscore @@ -903,7 +903,7 @@ DIM SHARED controlref(1000) AS LONG 'the line number the control was created on ON ERROR GOTO qberror i2&& = 1 -FOR i&& = 1 TO 56 +FOR i&& = 1 TO 64 bitmask(i&&) = i2&& bitmaskinv(i&&) = NOT i2&& i2&& = i2&& + 2 ^ i&& @@ -14818,10 +14818,10 @@ FUNCTION dim2 (varname$, typ2$, method, elements$) IF LEFT$(typ$, 7) <> "_BIT * " AND LEFT$(typ$, 6) <> "BIT * " THEN Give_Error "Expected " + qb64prefix$ + "BIT * number": EXIT FUNCTION c$ = MID$(typ$, INSTR(typ$, " * ") + 3) IF isuinteger(c$) = 0 THEN Give_Error "Number expected after *": EXIT FUNCTION - IF LEN(c$) > 2 THEN Give_Error "Too many characters in number after *": EXIT FUNCTION + IF LEN(c$) > 2 THEN Give_Error "Cannot create a bit variable of size > 64 bits": EXIT FUNCTION bits = VAL(c$) IF bits = 0 THEN Give_Error "Cannot create a bit variable of size 0 bits": EXIT FUNCTION - IF bits > 57 THEN Give_Error "Cannot create a bit variable of size > 24 bits": EXIT FUNCTION + IF bits > 64 THEN Give_Error "Cannot create a bit variable of size > 64 bits": EXIT FUNCTION ELSE bits = 1 END IF @@ -21467,7 +21467,7 @@ FUNCTION symboltype (s$) 'returns type or 0(not a valid symbol) IF isuinteger(RIGHT$(s$, l - 1)) THEN IF l > 3 THEN EXIT FUNCTION n = VAL(RIGHT$(s$, l - 1)) - IF n > 56 THEN EXIT FUNCTION + IF n > 64 THEN EXIT FUNCTION symboltype = n + ISOFFSETINBITS: EXIT FUNCTION END IF EXIT FUNCTION @@ -21493,7 +21493,7 @@ FUNCTION symboltype (s$) 'returns type or 0(not a valid symbol) IF isuinteger(RIGHT$(s$, l - 2)) THEN IF l > 4 THEN EXIT FUNCTION n = VAL(RIGHT$(s$, l - 2)) - IF n > 56 THEN EXIT FUNCTION + IF n > 64 THEN EXIT FUNCTION symboltype = n + ISOFFSETINBITS + ISUNSIGNED: EXIT FUNCTION END IF EXIT FUNCTION @@ -22467,7 +22467,7 @@ FUNCTION typ2ctyp$ (t AS LONG, tstr AS STRING) IF n$ <> "" THEN IF isuinteger(n$) = 0 THEN Give_Error "Invalid index after _BIT type": EXIT FUNCTION b = VAL(n$) - IF b > 57 THEN Give_Error "Invalid index after _BIT type": EXIT FUNCTION + IF b > 64 THEN Give_Error "Invalid index after _BIT type": EXIT FUNCTION END IF IF b <= 32 THEN ctyp$ = "int32" ELSE ctyp$ = "int64" IF unsgn THEN ctyp$ = "u" + ctyp$ @@ -22542,7 +22542,7 @@ FUNCTION type2symbol$ (typ$) IF isuinteger(t$) = 0 THEN Give_Error e$: EXIT FUNCTION v = VAL(t$) IF v = 0 THEN Give_Error e$: EXIT FUNCTION - IF s$ <> "$" AND v > 56 THEN Give_Error e$: EXIT FUNCTION + IF s$ <> "$" AND v > 64 THEN Give_Error e$: EXIT FUNCTION IF s$ = "$" THEN s$ = s$ + str2$(v) ELSE @@ -22592,7 +22592,7 @@ FUNCTION typname2typ& (t2$) IF n$ <> "" THEN IF isuinteger(n$) = 0 THEN Give_Error "Invalid index after _BIT type": EXIT FUNCTION b = VAL(n$) - IF b > 56 THEN Give_Error "Invalid index after _BIT type": EXIT FUNCTION + IF b > 64 THEN Give_Error "Invalid index after _BIT type": EXIT FUNCTION END IF IF unsgn THEN typname2typ& = UBITTYPE + (b - 1) ELSE typname2typ& = BITTYPE + (b - 1) EXIT FUNCTION @@ -22686,7 +22686,7 @@ FUNCTION typname2typ& (t2$) n$ = RIGHT$(t$, LEN(t$) - 7) IF isuinteger(n$) = 0 THEN Give_Error "Invalid size after " + qb64prefix$ + "BIT *": EXIT FUNCTION b = VAL(n$) - IF b = 0 OR b > 56 THEN Give_Error "Invalid size after " + qb64prefix$ + "BIT *": EXIT FUNCTION + IF b = 0 OR b > 64 THEN Give_Error "Invalid size after " + qb64prefix$ + "BIT *": EXIT FUNCTION t = BITTYPE - 1 + b: IF u THEN t = t + ISUNSIGNED typname2typ& = t EXIT FUNCTION From 3d5f115ebaca01220c68cd24f3b3c5d4a00b0cfe Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Sat, 11 Sep 2021 23:06:05 -0300 Subject: [PATCH 5/5] Improves handling of _BIT variables ($Debug). Allows setting values. --- source/ide/ide_methods.bas | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index ee6ca67e0..b3f3d8435 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -7103,6 +7103,10 @@ SUB DebugMode tempVarType$ = "_UNSIGNED _BIT" END IF SELECT CASE tempVarType$ + CASE "_BIT", "_UNSIGNED _BIT" + value$ = MKL$(VAL(value$)) + varSize& = LEN(dummy&) + result$ = STR$(CVL(value$)) CASE "_BYTE", "_UNSIGNED _BYTE", "BYTE", "UNSIGNED BYTE" value$ = _MK$(_BYTE, VAL(value$)) varSize& = LEN(dummy%%) @@ -7641,14 +7645,14 @@ SUB DebugMode IF INSTR(tempVarType$, "BIT *") THEN IF VAL(MID$(tempVarType$, _INSTRREV(tempVarType$, " ") + 1)) > 32 THEN tempVarType$ = "_INTEGER64" - IF INSTR(tempVarType$, "UNSIGNED") THEN tempVarType$ = "_UNSIGNED _INTEGER64" + IF INSTR(varType$, "UNSIGNED") THEN tempVarType$ = "_UNSIGNED _INTEGER64" ELSE tempVarType$ = "LONG" - IF INSTR(tempVarType$, "UNSIGNED") THEN tempVarType$ = "_UNSIGNED LONG" + IF INSTR(varType$, "UNSIGNED") THEN tempVarType$ = "_UNSIGNED LONG" END IF ELSEIF INSTR("@_BIT@BIT@_UNSIGNED _BIT@UNSIGNED BIT@", "@" + tempVarType$ + "@") THEN tempVarType$ = "LONG" - IF INSTR(tempVarType$, "UNSIGNED") THEN tempVarType$ = "_UNSIGNED LONG" + IF INSTR(varType$, "UNSIGNED") THEN tempVarType$ = "_UNSIGNED LONG" END IF SELECT CASE tempVarType$ CASE "_BYTE", "_UNSIGNED _BYTE", "BYTE", "UNSIGNED BYTE": varSize& = LEN(dummy%%)