1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-03 12:21:20 +00:00

Allows $DEBUG to be added anywhere in the code.

This commit is contained in:
FellippeHeitor 2021-07-14 20:34:47 -03:00
parent e8c42f8cc5
commit b5cdf1590e
2 changed files with 30 additions and 11 deletions

View file

@ -26,6 +26,8 @@ REDIM SHARED PL(1000) AS INTEGER 'Priority Level
REDIM SHARED PP_TypeMod(0) AS STRING, PP_ConvertedMod(0) AS STRING 'Prepass Name Conversion variables.
Set_OrderOfOperations
DIM SHARED vWatchOn, vWatchRecompileAttempts, vWatchDesiredState
REDIM EveryCaseSet(100), SelectCaseCounter AS _UNSIGNED LONG
REDIM SelectCaseHasCaseBlock(100)
DIM ExecLevel(255), ExecCounter AS INTEGER
@ -121,7 +123,7 @@ DIM SHARED viFileDescription$, viFileVersion$, viInternalName$
DIM SHARED viLegalCopyright$, viLegalTrademarks$, viOriginalFilename$
DIM SHARED viProductName$, viProductVersion$, viComments$, viWeb$
DIM SHARED NoChecks, vWatchOn, addingvWatch
DIM SHARED NoChecks
DIM SHARED Console
DIM SHARED ScreenHide
@ -1199,7 +1201,11 @@ sflistn = -1 'no entries
SubNameLabels = sp 'QB64 will perform a repass to resolve sub names used as labels
vWatchDesiredState = 0
vWatchRecompileAttempts = 0
recompile:
vWatchOn = vWatchDesiredState
lastLineReturn = 0
lastLine = 0
@ -1380,7 +1386,6 @@ fooindwel = 0
layout = ""
layoutok = 0
NoChecks = 0
vWatchOn = 0
inclevel = 0
errorLineInInclude = 0
addmetainclude$ = ""
@ -1601,6 +1606,7 @@ DO
forceIncludeFromRoot$ = ""
IF vWatchOn THEN
addingvWatch = 1
IF firstLine <> 0 THEN forceIncludeFromRoot$ = "source\utilities\vwatch.bi"
IF lastLine <> 0 THEN forceIncludeFromRoot$ = "source\utilities\vwatch.bm"
ELSE
'IF firstLine <> 0 THEN forceIncludeFromRoot$ = "source\embed\header_stub.bas"
@ -1670,6 +1676,19 @@ DO
GOTO finishedlinepp
END IF
IF temp$ = "$DEBUG" THEN
vWatchDesiredState = 1
IF vWatchOn = 0 THEN
IF vWatchRecompileAttempts = 0 THEN
'this is the first time a conflict has occurred, so react immediately with a full recompilation using the desired state
vWatchRecompileAttempts = vWatchRecompileAttempts + 1
GOTO do_recompile
ELSE
'continue compilation to retrieve the final state requested and act on that as required
END IF
END IF
END IF
IF LEFT$(temp$, 4) = "$IF " THEN
IF RIGHT$(temp$, 5) <> " THEN" THEN a$ = "$IF without THEN": GOTO errmes
temp$ = LTRIM$(MID$(temp$, 4)) 'strip off the $IF and extra spaces
@ -2822,6 +2841,7 @@ DO
forceIncludeFromRoot$ = ""
IF vWatchOn THEN
addingvWatch = 1
IF firstLine <> 0 THEN forceIncludeFromRoot$ = "source\utilities\vwatch.bi"
IF lastLine <> 0 THEN forceIncludeFromRoot$ = "source\utilities\vwatch.bm"
ELSE
'IF firstLine <> 0 THEN forceIncludeFromRoot$ = "source\embed\header_stub.bas"
@ -3074,26 +3094,19 @@ DO
IF a3u$ = "$VIRTUALKEYBOARD:ON" THEN
'Deprecated; does nothing.
layout$ = SCase$("$VirtualKeyboard:On")
addWarning linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), "Deprecated feature", "$VirtualKeyboard"
GOTO finishednonexec
END IF
IF a3u$ = "$VIRTUALKEYBOARD:OFF" THEN
'Deprecated; does nothing.
layout$ = SCase$("$VirtualKeyboard:Off")
addWarning linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), "Deprecated feature", "$VirtualKeyboard"
GOTO finishednonexec
END IF
IF a3u$ = "$DEBUG" THEN
IF vWatchOn THEN
a$ = "Duplicate $DEBUG metacommand": GOTO errmes
END IF
layout$ = SCase$("$Debug")
IF NoChecks THEN
addWarning linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), "$DEBUG is disabled in $CHECKING:OFF blocks", ""
END IF
addmetainclude$ = getfilepath$(COMMAND$(0)) + "source" + pathsep$ + "utilities" + pathsep$ + "vwatch.bi"
vWatchOn = 1
GOTO finishednonexec
END IF
@ -11427,6 +11440,11 @@ FOR x = 1 TO commonarraylistn
NEXT
IF Debug THEN PRINT #9, "Finished COMMON array list check!"
IF vWatchDesiredState <> vWatchOn THEN
vWatchRecompileAttempts = vWatchRecompileAttempts + 1
recompile = 1
END IF
IF recompile THEN
do_recompile:
IF Debug THEN PRINT #9, "Recompile required!"

View file

@ -1,6 +1,7 @@
$CHECKING:OFF
DIM SHARED vwatch_linenumber AS LONG
REDIM SHARED vwatch_breakpoints(0) AS _BYTE
'next lines are just to avoid "unused variable" warnings:
vwatch_linenumber = 0
vwatch_breakpoints(0) = 0
$CHECKING:ON