1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-06-26 17:10:38 +00:00

Implements "Skip Line"

Ctrl+P to set line to skip.
Ctrl+Line Click to set line to skip with mouse.
This commit is contained in:
FellippeHeitor 2021-07-20 02:50:54 -03:00
parent aefde3eb55
commit 5e53786255
5 changed files with 194 additions and 63 deletions

View file

@ -42,6 +42,7 @@ DIM SHARED QuickNavTotal AS LONG
DIM SHARED QuickNavHistory(0) AS QuickNavType
REDIM SHARED IdeBreakpoints(1) AS _BYTE
REDIM SHARED IdeSkipLines(1) AS _BYTE
'GetInput global variables
DIM SHARED iCHECKLATER 'the values will be checked later

View file

@ -474,6 +474,7 @@ FUNCTION ide2 (ignore)
'new blank text field
idet$ = MKL$(0) + MKL$(0): idel = 1: ideli = 1: iden = 1: IdeBmkN = 0
REDIM IdeBreakpoints(iden) AS _BYTE
REDIM IdeSkipLines(iden) AS _BYTE
callstacklist$ = "": callStackLength = 0
ideunsaved = -1
idechangemade = 1
@ -566,6 +567,7 @@ FUNCTION ide2 (ignore)
lineinput3buffer = ""
iden = n: IF n = 0 THEN idet$ = MKL$(0) + MKL$(0): iden = 1 ELSE idet$ = LEFT$(idet$, i2 - 1)
REDIM IdeBreakpoints(iden) AS _BYTE
REDIM IdeSkipLines(iden) AS _BYTE
IF ideStartAtLine > 0 AND ideStartAtLine <= iden THEN
idecy = ideStartAtLine
IF idecy - 10 >= 1 THEN idesy = idecy - 10
@ -5646,6 +5648,7 @@ FUNCTION ide2 (ignore)
ELSE
IdeBreakpoints(idecy) = NOT IdeBreakpoints(idecy)
END IF
IF IdeBreakpoints(idecy) THEN IdeSkipLines(idecy) = 0
GOTO ideloop
END IF
@ -5708,6 +5711,7 @@ FUNCTION ide2 (ignore)
ideunsaved = -1
'new blank text field
REDIM IdeBreakpoints(1) AS _BYTE
REDIM IdeSkipLines(1) AS _BYTE
callstacklist$ = "": callStackLength = 0
idet$ = MKL$(0) + MKL$(0): idel = 1: ideli = 1: iden = 1: IdeBmkN = 0
idesx = 1
@ -6211,6 +6215,21 @@ SUB DebugMode
GOSUB SendCommand
END IF
skipCount = 0
skipList$ = ""
FOR i = 1 TO UBOUND(IdeSkipLines)
IF IdeSkipLines(i) THEN
skipCount = skipCount + 1
skipList$ = skipList$ + MKL$(i)
END IF
NEXT
IF skipCount THEN
cmd$ = "skip count:" + MKL$(skipCount)
GOSUB SendCommand
cmd$ = "skip list:" + skipList$
GOSUB SendCommand
END IF
clearStatusWindow 1
IF startPaused THEN
cmd$ = "break"
@ -6313,9 +6332,26 @@ SUB DebugMode
ideselect = 0
idecytemp = mY - 2 + idesy - 1
IF idecytemp =< iden THEN
IdeBreakpoints(idecytemp) = NOT IdeBreakpoints(idecytemp)
IF IdeBreakpoints(idecytemp) THEN cmd$ = "set breakpoint:" ELSE cmd$ = "clear breakpoint:"
cmd$ = cmd$ + MKL$(idecytemp)
IF _KEYDOWN(100306) OR _KEYDOWN(100305) THEN
IF IdeSkipLines(idecytemp) = -1 THEN
IdeSkipLines(idecytemp) = 0
cmd$ = "clear skip line:" + MKL$(idecytemp)
ELSE
IdeSkipLines(idecytemp) = -1
IdeBreakpoints(idecytemp) = 0
cmd$ = "set skip line:" + MKL$(idecytemp)
END IF
ELSE
IF IdeBreakpoints(idecytemp) THEN
IdeBreakpoints(idecytemp) = 0
cmd$ = "clear breakpoint:"
ELSE
IdeBreakpoints(idecytemp) = -1
IdeSkipLines(idecytemp) = 0
cmd$ = "set breakpoint:"
END IF
cmd$ = cmd$ + MKL$(idecytemp)
END IF
GOSUB SendCommand
GOSUB UpdateDisplay
END IF
@ -6502,7 +6538,12 @@ SUB DebugMode
CASE 17152 'F9
IF PauseMode THEN
IdeBreakpoints(idecy) = NOT IdeBreakpoints(idecy)
IF IdeBreakpoints(idecy) THEN cmd$ = "set breakpoint:" ELSE cmd$ = "clear breakpoint:"
IF IdeBreakpoints(idecy) THEN
IdeSkipLines(idecy) = 0
cmd$ = "set breakpoint:"
ELSE
cmd$ = "clear breakpoint:"
END IF
cmd$ = cmd$ + MKL$(idecy)
GOSUB SendCommand
GOSUB UpdateDisplay
@ -6514,13 +6555,24 @@ SUB DebugMode
GOSUB UpdateDisplay
CASE 103, 71 'g, G
IF _KEYDOWN(100306) OR _KEYDOWN(100305) THEN
result = idesetnextlinebox
result = idegetlinenumberbox("Set Next Line")
PCOPY 3, 0: SCREEN , , 3, 0
IF result > 0 THEN
IF result > 0 AND result < iden THEN
cmd$ = "set next line:" + MKL$(result)
GOSUB SendCommand
END IF
END IF
CASE 112, 80 'p, P
IF _KEYDOWN(100306) OR _KEYDOWN(100305) THEN
result = idegetlinenumberbox("Skip Line")
PCOPY 3, 0: SCREEN , , 3, 0
IF result > 0 AND result <= iden THEN
cmd$ = "set skip line:" + MKL$(result)
GOSUB SendCommand
IdeSkipLines(result) = -1
GOSUB UpdateDisplay
END IF
END IF
END SELECT
GOSUB GetCommand
@ -8129,6 +8181,13 @@ SUB ideinsline (i, text$)
NEXT
IdeBreakpoints(i) = 0
REDIM _PRESERVE IdeSkipLines(iden + 1) AS _BYTE
FOR b = iden + 1 TO i STEP -1
SWAP IdeSkipLines(b), IdeSkipLines(b - 1)
NEXT
IdeSkipLines(i) = 0
text$ = RTRIM$(text$)
IF i = -1 THEN i = idel
@ -8696,6 +8755,7 @@ FUNCTION idefiledialog$(programname$, mode AS _BYTE)
lineinput3buffer = ""
iden = n: IF n = 0 THEN idet$ = MKL$(0) + MKL$(0): iden = 1 ELSE idet$ = LEFT$(idet$, i2 - 1)
REDIM IdeBreakpoints(iden) AS _BYTE
REDIM IdeSkipLines(iden) AS _BYTE
callstacklist$ = "": callStackLength = 0
ideerror = 1
@ -9444,14 +9504,23 @@ SUB ideshowtext
DO WHILE l > UBOUND(IdeBreakpoints)
REDIM _PRESERVE IdeBreakpoints(UBOUND(IdeBreakpoints) + 100) AS _BYTE
LOOP
DO WHILE l > UBOUND(IdeSkipLines)
REDIM _PRESERVE IdeSkipLines(UBOUND(IdeSkipLines) + 100) AS _BYTE
LOOP
IF ShowLineNumbers THEN
IF ShowLineNumbersUseBG THEN COLOR , 6
IF vWatchOn = 1 AND IdeBreakpoints(l) <> 0 THEN COLOR , 4
IF vWatchOn = 1 AND IdeSkipLines(l) <> 0 THEN COLOR 14
_PRINTSTRING (2, y + 3), SPACE$(maxLineNumberLength)
IF l <= iden THEN
l2$ = STR$(l)
IF 2 + maxLineNumberLength - (LEN(l2$) + 1) >= 2 THEN
_PRINTSTRING (2 + maxLineNumberLength - (LEN(l2$) + 1), y + 3), l2$
IF vWatchOn AND IdeSkipLines(l) <> 0 THEN
_PRINTSTRING (2, y + 3), "!"
END IF
END IF
END IF
IF ShowLineNumbersSeparator THEN
@ -9474,6 +9543,9 @@ SUB ideshowtext
IF l = debugnextline THEN
COLOR 10
_PRINTSTRING (1, y + 3), CHR$(16)
ELSEIF IdeSkipLines(l) <> 0 THEN
COLOR 14
_PRINTSTRING (1, y + 3), "!"
ELSE
_PRINTSTRING (1, y + 3), CHR$(179)
END IF
@ -11472,16 +11544,16 @@ SUB idegotobox
ideselect = 0
END SUB
FUNCTION idesetnextlinebox
FUNCTION idegetlinenumberbox(title$)
a2$ = ""
v$ = ideinputbox$("Set Next Line", "#Line", a2$, "0123456789", 30, 8)
v$ = ideinputbox$(title$, "#Line", a2$, "0123456789", 30, 8)
IF v$ = "" THEN EXIT FUNCTION
v& = VAL(v$)
IF v& < 1 THEN v& = 1
IF v& > iden THEN v& = iden
idesetnextlinebox = v&
idegetlinenumberbox = v&
END FUNCTION

View file

@ -5301,9 +5301,9 @@ DO
PRINT #12, "exit_subfunc:;"
IF vWatchOn = 1 THEN
IF NoChecks = 0 THEN
vWatchTagLabel linenumber: IF firstLineNumberLabelvWatch = 0 THEN firstLineNumberLabelvWatch = linenumber
IF lastLineNumberLabelvWatch <> linenumber THEN PRINT #12, "VWATCH_LABEL_" + str2$(linenumber) + ":;": lastLineNumberLabelvWatch = linenumber
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE;"
vWatchTagLabel linenumber, 0
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE; if (*__LONG_VWATCH_GOTO<0) goto VWATCH_SKIPLINE;"
vWatchTagLabel 0, -1
END IF
PRINT #12, "*__LONG_VWATCH_SUBLEVEL=*__LONG_VWATCH_SUBLEVEL- 1 ;"
@ -5322,6 +5322,18 @@ DO
PRINT #12, " *__LONG_VWATCH_GOTO=*__LONG_VWATCH_LINENUMBER;"
PRINT #12, " goto VWATCH_SETNEXTLINE;"
PRINT #12, "}"
PRINT #12, "VWATCH_SKIPLINE:;"
PRINT #12, "switch (*__LONG_VWATCH_GOTO) {"
FOR i = firstLineNumberLabelvWatch TO lastLineNumberLabelvWatch
IF ASC(vWatchUsedLabels, i) = 1 THEN
PRINT #12, " case -" + str2$(i) + ":"
PRINT #12, " goto VWATCH_SKIPLABEL_" + str2$(i) + ";"
PRINT #12, " break;"
END IF
NEXT
PRINT #12, "}"
PRINT #12, "VWATCH_SKIPSETNEXTLINE:;"
END IF
firstLineNumberLabelvWatch = 0
@ -5600,9 +5612,8 @@ DO
IF stringprocessinghappened THEN e$ = cleanupstringprocessingcall$ + e$ + ")"
IF (typ AND ISSTRING) THEN a$ = "WHILE ERROR! Cannot accept a STRING type.": GOTO errmes
IF NoChecks = 0 AND vWatchOn = 1 THEN
vWatchTagLabel linenumber: IF firstLineNumberLabelvWatch = 0 THEN firstLineNumberLabelvWatch = linenumber
IF lastLineNumberLabelvWatch <> linenumber THEN PRINT #12, "VWATCH_LABEL_" + str2$(linenumber) + ":;": lastLineNumberLabelvWatch = linenumber
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE;"
vWatchTagLabel linenumber, 0
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE; if (*__LONG_VWATCH_GOTO<0) goto VWATCH_SKIPLINE;"
END IF
PRINT #12, "while((" + e$ + ")||new_error){"
ELSE
@ -5661,17 +5672,15 @@ DO
IF (typ AND ISSTRING) THEN a$ = "DO ERROR! Cannot accept a STRING type.": GOTO errmes
IF whileuntil = 1 THEN PRINT #12, "while((" + e$ + ")||new_error){" ELSE PRINT #12, "while((!(" + e$ + "))||new_error){"
IF NoChecks = 0 AND vWatchOn = 1 THEN
vWatchTagLabel linenumber: IF firstLineNumberLabelvWatch = 0 THEN firstLineNumberLabelvWatch = linenumber
IF lastLineNumberLabelvWatch <> linenumber THEN PRINT #12, "VWATCH_LABEL_" + str2$(linenumber) + ":;": lastLineNumberLabelvWatch = linenumber
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE;"
vWatchTagLabel linenumber, 0
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE; if (*__LONG_VWATCH_GOTO<0) goto VWATCH_SKIPLINE;"
END IF
controltype(controllevel) = 4
ELSE
controltype(controllevel) = 3
IF vWatchOn = 1 AND inclinenumber(inclevel) = 0 AND NoChecks = 0 THEN
vWatchTagLabel linenumber: IF firstLineNumberLabelvWatch = 0 THEN firstLineNumberLabelvWatch = linenumber
IF lastLineNumberLabelvWatch <> linenumber THEN PRINT #12, "VWATCH_LABEL_" + str2$(linenumber) + ":;": lastLineNumberLabelvWatch = linenumber
PRINT #12, "do{*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE;"
vWatchTagLabel linenumber, 0
PRINT #12, "do{*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE; if (*__LONG_VWATCH_GOTO<0) goto VWATCH_SKIPLINE;"
ELSE
PRINT #12, "do{"
END IF
@ -5705,18 +5714,16 @@ DO
IF (typ AND ISSTRING) THEN a$ = "LOOP ERROR! Cannot accept a STRING type.": GOTO errmes
PRINT #12, "dl_continue_" + str2$(controlid(controllevel)) + ":;"
IF NoChecks = 0 AND vWatchOn = 1 THEN
vWatchTagLabel linenumber: IF firstLineNumberLabelvWatch = 0 THEN firstLineNumberLabelvWatch = linenumber
IF lastLineNumberLabelvWatch <> linenumber THEN PRINT #12, "VWATCH_LABEL_" + str2$(linenumber) + ":;": lastLineNumberLabelvWatch = linenumber
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE;"
vWatchTagLabel linenumber, 0
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE; if (*__LONG_VWATCH_GOTO<0) goto VWATCH_SKIPLINE;"
END IF
IF whileuntil = 1 THEN PRINT #12, "}while((" + e$ + ")&&(!new_error));" ELSE PRINT #12, "}while((!(" + e$ + "))&&(!new_error));"
ELSE
PRINT #12, "dl_continue_" + str2$(controlid(controllevel)) + ":;"
IF NoChecks = 0 AND vWatchOn = 1 THEN
vWatchTagLabel linenumber: IF firstLineNumberLabelvWatch = 0 THEN firstLineNumberLabelvWatch = linenumber
IF lastLineNumberLabelvWatch <> linenumber THEN PRINT #12, "VWATCH_LABEL_" + str2$(linenumber) + ":;": lastLineNumberLabelvWatch = linenumber
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE;"
vWatchTagLabel linenumber, 0
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE; if (*__LONG_VWATCH_GOTO<0) goto VWATCH_SKIPLINE;"
END IF
IF controltype(controllevel) = 4 THEN
@ -5869,9 +5876,8 @@ DO
IF Error_Happened THEN GOTO errmes
IF NoChecks = 0 AND vWatchOn = 1 THEN
vWatchTagLabel linenumber: IF firstLineNumberLabelvWatch = 0 THEN firstLineNumberLabelvWatch = linenumber
IF lastLineNumberLabelvWatch <> linenumber THEN PRINT #12, "VWATCH_LABEL_" + str2$(linenumber) + ":;": lastLineNumberLabelvWatch = linenumber
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE;"
vWatchTagLabel linenumber, 0
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE; if (*__LONG_VWATCH_GOTO<0) goto VWATCH_SKIPLINE;"
END IF
PRINT #12, "fornext_step" + u$ + "=" + e$ + ";"
@ -5958,9 +5964,8 @@ DO
IF NoChecks = 0 THEN
PRINT #12, "S_" + str2$(statementn) + ":;": dynscope = 1
IF vWatchOn = 1 AND inclinenumber(inclevel) = 0 THEN
vWatchTagLabel linenumber: IF firstLineNumberLabelvWatch = 0 THEN firstLineNumberLabelvWatch = linenumber
IF lastLineNumberLabelvWatch <> linenumber THEN PRINT #12, "VWATCH_LABEL_" + str2$(linenumber) + ":;": lastLineNumberLabelvWatch = linenumber
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE;"
vWatchTagLabel linenumber, 0
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE; if (*__LONG_VWATCH_GOTO<0) goto VWATCH_SKIPLINE;"
END IF
END IF
FOR i = controllevel TO 1 STEP -1
@ -6001,9 +6006,8 @@ DO
IF NoChecks = 0 THEN
PRINT #12, "S_" + str2$(statementn) + ":;": dynscope = 1
IF vWatchOn = 1 AND inclinenumber(inclevel) = 0 THEN
vWatchTagLabel linenumber: IF firstLineNumberLabelvWatch = 0 THEN firstLineNumberLabelvWatch = linenumber
IF lastLineNumberLabelvWatch <> linenumber THEN PRINT #12, "VWATCH_LABEL_" + str2$(linenumber) + ":;": lastLineNumberLabelvWatch = linenumber
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE;"
vWatchTagLabel linenumber, 0
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE; if (*__LONG_VWATCH_GOTO<0) goto VWATCH_SKIPLINE;"
END IF
END IF
@ -6085,9 +6089,8 @@ DO
END IF
IF vWatchOn = 1 AND inclinenumber(inclevel) = 0 THEN
vWatchTagLabel linenumber: IF firstLineNumberLabelvWatch = 0 THEN firstLineNumberLabelvWatch = linenumber
IF lastLineNumberLabelvWatch <> linenumber THEN PRINT #12, "VWATCH_LABEL_" + str2$(linenumber) + ":;": lastLineNumberLabelvWatch = linenumber
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE;"
vWatchTagLabel linenumber, 0
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE; if (*__LONG_VWATCH_GOTO<0) goto VWATCH_SKIPLINE;"
END IF
PRINT #12, "}"
@ -6107,9 +6110,8 @@ DO
IF NoChecks = 0 THEN
PRINT #12, "S_" + str2$(statementn) + ":;": dynscope = 1
IF vWatchOn = 1 AND inclinenumber(inclevel) = 0 THEN
vWatchTagLabel linenumber: IF firstLineNumberLabelvWatch = 0 THEN firstLineNumberLabelvWatch = linenumber
IF lastLineNumberLabelvWatch <> linenumber THEN PRINT #12, "VWATCH_LABEL_" + str2$(linenumber) + ":;": lastLineNumberLabelvWatch = linenumber
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE;"
vWatchTagLabel linenumber, 0
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE; if (*__LONG_VWATCH_GOTO<0) goto VWATCH_SKIPLINE;"
END IF
END IF
@ -6234,9 +6236,8 @@ DO
IF controltype(controllevel) < 10 OR controltype(controllevel) > 17 THEN a$ = "END SELECT without SELECT CASE": GOTO errmes
IF vWatchOn = 1 AND inclinenumber(inclevel) = 0 THEN
vWatchTagLabel linenumber: IF firstLineNumberLabelvWatch = 0 THEN firstLineNumberLabelvWatch = linenumber
IF lastLineNumberLabelvWatch <> linenumber THEN PRINT #12, "VWATCH_LABEL_" + str2$(linenumber) + ":;": lastLineNumberLabelvWatch = linenumber
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE;"
vWatchTagLabel linenumber, 0
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE; if (*__LONG_VWATCH_GOTO<0) goto VWATCH_SKIPLINE;"
END IF
IF SelectCaseCounter > 0 AND SelectCaseHasCaseBlock(SelectCaseCounter) = 0 THEN
@ -6354,9 +6355,8 @@ DO
IF NoChecks = 0 THEN
PRINT #12, "S_" + str2$(statementn) + ":;": dynscope = 1
IF vWatchOn = 1 AND inclinenumber(inclevel) = 0 THEN
vWatchTagLabel linenumber: IF firstLineNumberLabelvWatch = 0 THEN firstLineNumberLabelvWatch = linenumber
IF lastLineNumberLabelvWatch <> linenumber THEN PRINT #12, "VWATCH_LABEL_" + str2$(linenumber) + ":;": lastLineNumberLabelvWatch = linenumber
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE;"
vWatchTagLabel linenumber, 0
PRINT #12, "*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE; if (*__LONG_VWATCH_GOTO<0) goto VWATCH_SKIPLINE;"
END IF
END IF
@ -6544,9 +6544,8 @@ DO
IF NoChecks = 0 THEN
IF vWatchOn = 1 AND inclinenumber(inclevel) = 0 THEN
vWatchTagLabel linenumber: IF firstLineNumberLabelvWatch = 0 THEN firstLineNumberLabelvWatch = linenumber
IF lastLineNumberLabelvWatch <> linenumber THEN PRINT #12, "VWATCH_LABEL_" + str2$(linenumber) + ":;": lastLineNumberLabelvWatch = linenumber
PRINT #12, "do{*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE;"
vWatchTagLabel linenumber, 0
PRINT #12, "do{*__LONG_VWATCH_LINENUMBER= " + str2$(linenumber) + "; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE; if (*__LONG_VWATCH_GOTO<0) goto VWATCH_SKIPLINE;"
ELSE
PRINT #12, "do{"
END IF
@ -8893,9 +8892,8 @@ DO
IF vWatchOn = 1 THEN
vWatchTagLabel linenumber: IF firstLineNumberLabelvWatch = 0 THEN firstLineNumberLabelvWatch = linenumber
IF lastLineNumberLabelvWatch <> linenumber THEN PRINT #12, "VWATCH_LABEL_" + str2$(linenumber) + ":;": lastLineNumberLabelvWatch = linenumber
PRINT #12, "*__LONG_VWATCH_LINENUMBER= 0; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE;"
vWatchTagLabel linenumber, 0
PRINT #12, "*__LONG_VWATCH_LINENUMBER= 0; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE; if (*__LONG_VWATCH_GOTO<0) goto VWATCH_SKIPLINE;"
END IF
PRINT #12, "if (sub_gl_called) error(271);"
PRINT #12, "close_program=1;"
@ -8918,9 +8916,8 @@ DO
END IF
layoutdone = 1: IF LEN(layout$) THEN layout$ = layout$ + sp + l$ ELSE layout$ = l$
IF vWatchOn = 1 AND NoChecks = 0 THEN
vWatchTagLabel linenumber: IF firstLineNumberLabelvWatch = 0 THEN firstLineNumberLabelvWatch = linenumber
IF lastLineNumberLabelvWatch <> linenumber THEN PRINT #12, "VWATCH_LABEL_" + str2$(linenumber) + ":;": lastLineNumberLabelvWatch = linenumber
PRINT #12, "*__LONG_VWATCH_LINENUMBER=-3; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE;"
vWatchTagLabel linenumber, 0
PRINT #12, "*__LONG_VWATCH_LINENUMBER=-3; SUB_VWATCH((ptrszint*)vwatch_local_vars); if (*__LONG_VWATCH_GOTO>0) goto VWATCH_SETNEXTLINE; if (*__LONG_VWATCH_GOTO<0) goto VWATCH_SKIPLINE;"
ELSE
PRINT #12, "close_program=1;"
PRINT #12, "end();"
@ -14210,11 +14207,27 @@ SUB clearid
id = cleariddata
END SUB
SUB vWatchTagLabel (this AS LONG)
WHILE this > LEN(vWatchUsedLabels)
vWatchUsedLabels = vWatchUsedLabels + SPACE$(1000)
WEND
ASC(vWatchUsedLabels, this) = 1
SUB vWatchTagLabel (this AS LONG, lastLine AS _BYTE)
STATIC prevLabel AS LONG
IF lastLine THEN
PRINT #12, "VWATCH_SKIPLABEL_" + str2$(prevLabel) + ":;"
ELSE
WHILE this > LEN(vWatchUsedLabels)
vWatchUsedLabels = vWatchUsedLabels + SPACE$(1000)
WEND
ASC(vWatchUsedLabels, this) = 1
IF firstLineNumberLabelvWatch = 0 THEN
firstLineNumberLabelvWatch = this
ELSE
IF prevLabel <> this THEN
PRINT #12, "VWATCH_SKIPLABEL_" + str2$(prevLabel) + ":;"
END IF
END IF
prevLabel = this
IF lastLineNumberLabelvWatch <> this THEN PRINT #12, "VWATCH_LABEL_" + str2$(this) + ":;": lastLineNumberLabelvWatch = this
END IF
END SUB
SUB closemain
@ -14236,6 +14249,18 @@ SUB closemain
PRINT #12, " *__LONG_VWATCH_GOTO=*__LONG_VWATCH_LINENUMBER;"
PRINT #12, " goto VWATCH_SETNEXTLINE;"
PRINT #12, "}"
PRINT #12, "VWATCH_SKIPLINE:;"
PRINT #12, "switch (*__LONG_VWATCH_GOTO) {"
FOR i = firstLineNumberLabelvWatch TO lastLineNumberLabelvWatch
IF ASC(vWatchUsedLabels, i) = 1 THEN
PRINT #12, " case -" + str2$(i) + ":"
PRINT #12, " goto VWATCH_SKIPLABEL_" + str2$(i) + ";"
PRINT #12, " break;"
END IF
NEXT
PRINT #12, "}"
END IF
PRINT #12, "}"
@ -22704,6 +22729,7 @@ END FUNCTION
SUB xend
IF vWatchOn = 1 THEN
vWatchTagLabel 0, -1
PRINT #12, "*__LONG_VWATCH_LINENUMBER= 0; SUB_VWATCH((ptrszint*)vwatch_local_vars);"
END IF
PRINT #12, "sub_end();"

View file

@ -2,11 +2,13 @@ $CHECKING:OFF
DIM SHARED AS LONG vwatch_linenumber, vwatch_sublevel, vwatch_goto
DIM SHARED AS STRING vwatch_subname, vwatch_callstack
REDIM SHARED vwatch_breakpoints(0) AS _BYTE
REDIM SHARED vwatch_skiplines(0) AS _BYTE
'next lines are just to avoid "unused variable" warnings:
vwatch_linenumber = 0
vwatch_sublevel = 0
vwatch_goto = 0
vwatch_breakpoints(0) = 0
vwatch_skiplines(0) = 0
vwatch_subname = ""
vwatch_callstack = ""
$CHECKING:ON

View file

@ -1,7 +1,7 @@
$CHECKING:OFF
SUB vwatch (localVariables AS _OFFSET)
STATIC AS LONG ide, breakpointCount, timeout, startLevel, lastLine
STATIC AS LONG ide, breakpointCount, skipCount, timeout, startLevel, lastLine
STATIC AS LONG callStackLength
STATIC AS _BYTE pauseMode, stepOver, bypass, setNextLine
STATIC buffer$, endc$
@ -41,6 +41,7 @@ SUB vwatch (localVariables AS _OFFSET)
END IF
CASE "line count"
REDIM vwatch_breakpoints(CVL(value$)) AS _BYTE
REDIM vwatch_skiplines(CVL(value$)) AS _BYTE
CASE "breakpoint count"
breakpointCount = CVL(value$)
CASE "breakpoint list"
@ -55,6 +56,20 @@ SUB vwatch (localVariables AS _OFFSET)
temp$ = MID$(value$, i * 4 - 3, 4)
vwatch_breakpoints(CVL(temp$)) = -1
NEXT
CASE "skip count"
skipCount = CVL(value$)
CASE "skip list"
IF LEN(value$) \ 4 <> skipCount THEN
cmd$ = "quit:Communication error."
GOSUB SendCommand
CLOSE #ide
bypass = -1
EXIT SUB
END IF
FOR i = 1 TO skipCount
temp$ = MID$(value$, i * 4 - 3, 4)
vwatch_skiplines(CVL(temp$)) = -1
NEXT
CASE "run"
IF vwatch_breakpoints(vwatch_linenumber) THEN EXIT DO
pauseMode = 0
@ -109,12 +124,20 @@ SUB vwatch (localVariables AS _OFFSET)
cmd$ = ""
CASE "set breakpoint"
vwatch_breakpoints(CVL(value$)) = -1
vwatch_skiplines(CVL(value$)) = 0
CASE "clear breakpoint"
vwatch_breakpoints(CVL(value$)) = 0
CASE "set skip line"
vwatch_skiplines(CVL(value$)) = -1
vwatch_breakpoints(CVL(value$)) = 0
CASE "clear skip line"
vwatch_skiplines(CVL(value$)) = 0
CASE "clear all breakpoints"
REDIM vwatch_breakpoints(UBOUND(vwatch_breakpoints)) AS _BYTE
END SELECT
IF vwatch_skiplines(vwatch_linenumber) THEN vwatch_goto = -vwatch_linenumber: EXIT SUB
IF stepOver = -1 AND vwatch_sublevel > startLevel AND vwatch_breakpoints(vwatch_linenumber) = 0 THEN
EXIT SUB
ELSEIF stepOver = -1 AND vwatch_sublevel = startLevel THEN
@ -163,6 +186,7 @@ SUB vwatch (localVariables AS _OFFSET)
EXIT SUB
CASE "set breakpoint"
vwatch_breakpoints(CVL(value$)) = -1
vwatch_skiplines(CVL(value$)) = 0
CASE "clear breakpoint"
vwatch_breakpoints(CVL(value$)) = 0
CASE "clear all breakpoints"
@ -180,6 +204,11 @@ SUB vwatch (localVariables AS _OFFSET)
setNextLine = -1
vwatch_goto = CVL(value$)
EXIT SUB
CASE "set skip line"
vwatch_skiplines(CVL(value$)) = -1
vwatch_breakpoints(CVL(value$)) = 0
CASE "clear skip line"
vwatch_skiplines(CVL(value$)) = 0
END SELECT
GOSUB GetCommand
@ -190,6 +219,7 @@ SUB vwatch (localVariables AS _OFFSET)
EXIT SUB
Connect:
DIM ideport$
ideport$ = ENVIRON$("QB64DEBUGPORT")
IF ideport$ = "" THEN bypass = -1: EXIT SUB