1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-05 17:00:26 +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. REDIM SHARED PP_TypeMod(0) AS STRING, PP_ConvertedMod(0) AS STRING 'Prepass Name Conversion variables.
Set_OrderOfOperations Set_OrderOfOperations
DIM SHARED vWatchOn, vWatchRecompileAttempts, vWatchDesiredState
REDIM EveryCaseSet(100), SelectCaseCounter AS _UNSIGNED LONG REDIM EveryCaseSet(100), SelectCaseCounter AS _UNSIGNED LONG
REDIM SelectCaseHasCaseBlock(100) REDIM SelectCaseHasCaseBlock(100)
DIM ExecLevel(255), ExecCounter AS INTEGER DIM ExecLevel(255), ExecCounter AS INTEGER
@ -121,7 +123,7 @@ DIM SHARED viFileDescription$, viFileVersion$, viInternalName$
DIM SHARED viLegalCopyright$, viLegalTrademarks$, viOriginalFilename$ DIM SHARED viLegalCopyright$, viLegalTrademarks$, viOriginalFilename$
DIM SHARED viProductName$, viProductVersion$, viComments$, viWeb$ DIM SHARED viProductName$, viProductVersion$, viComments$, viWeb$
DIM SHARED NoChecks, vWatchOn, addingvWatch DIM SHARED NoChecks
DIM SHARED Console DIM SHARED Console
DIM SHARED ScreenHide 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 SubNameLabels = sp 'QB64 will perform a repass to resolve sub names used as labels
vWatchDesiredState = 0
vWatchRecompileAttempts = 0
recompile: recompile:
vWatchOn = vWatchDesiredState
lastLineReturn = 0 lastLineReturn = 0
lastLine = 0 lastLine = 0
@ -1380,7 +1386,6 @@ fooindwel = 0
layout = "" layout = ""
layoutok = 0 layoutok = 0
NoChecks = 0 NoChecks = 0
vWatchOn = 0
inclevel = 0 inclevel = 0
errorLineInInclude = 0 errorLineInInclude = 0
addmetainclude$ = "" addmetainclude$ = ""
@ -1601,6 +1606,7 @@ DO
forceIncludeFromRoot$ = "" forceIncludeFromRoot$ = ""
IF vWatchOn THEN IF vWatchOn THEN
addingvWatch = 1 addingvWatch = 1
IF firstLine <> 0 THEN forceIncludeFromRoot$ = "source\utilities\vwatch.bi"
IF lastLine <> 0 THEN forceIncludeFromRoot$ = "source\utilities\vwatch.bm" IF lastLine <> 0 THEN forceIncludeFromRoot$ = "source\utilities\vwatch.bm"
ELSE ELSE
'IF firstLine <> 0 THEN forceIncludeFromRoot$ = "source\embed\header_stub.bas" 'IF firstLine <> 0 THEN forceIncludeFromRoot$ = "source\embed\header_stub.bas"
@ -1670,6 +1676,19 @@ DO
GOTO finishedlinepp GOTO finishedlinepp
END IF 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 LEFT$(temp$, 4) = "$IF " THEN
IF RIGHT$(temp$, 5) <> " THEN" THEN a$ = "$IF without THEN": GOTO errmes IF RIGHT$(temp$, 5) <> " THEN" THEN a$ = "$IF without THEN": GOTO errmes
temp$ = LTRIM$(MID$(temp$, 4)) 'strip off the $IF and extra spaces temp$ = LTRIM$(MID$(temp$, 4)) 'strip off the $IF and extra spaces
@ -2822,6 +2841,7 @@ DO
forceIncludeFromRoot$ = "" forceIncludeFromRoot$ = ""
IF vWatchOn THEN IF vWatchOn THEN
addingvWatch = 1 addingvWatch = 1
IF firstLine <> 0 THEN forceIncludeFromRoot$ = "source\utilities\vwatch.bi"
IF lastLine <> 0 THEN forceIncludeFromRoot$ = "source\utilities\vwatch.bm" IF lastLine <> 0 THEN forceIncludeFromRoot$ = "source\utilities\vwatch.bm"
ELSE ELSE
'IF firstLine <> 0 THEN forceIncludeFromRoot$ = "source\embed\header_stub.bas" 'IF firstLine <> 0 THEN forceIncludeFromRoot$ = "source\embed\header_stub.bas"
@ -3074,26 +3094,19 @@ DO
IF a3u$ = "$VIRTUALKEYBOARD:ON" THEN IF a3u$ = "$VIRTUALKEYBOARD:ON" THEN
'Deprecated; does nothing. 'Deprecated; does nothing.
layout$ = SCase$("$VirtualKeyboard:On") layout$ = SCase$("$VirtualKeyboard:On")
addWarning linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), "Deprecated feature", "$VirtualKeyboard"
GOTO finishednonexec GOTO finishednonexec
END IF END IF
IF a3u$ = "$VIRTUALKEYBOARD:OFF" THEN IF a3u$ = "$VIRTUALKEYBOARD:OFF" THEN
'Deprecated; does nothing. 'Deprecated; does nothing.
layout$ = SCase$("$VirtualKeyboard:Off") layout$ = SCase$("$VirtualKeyboard:Off")
addWarning linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), "Deprecated feature", "$VirtualKeyboard"
GOTO finishednonexec GOTO finishednonexec
END IF END IF
IF a3u$ = "$DEBUG" THEN IF a3u$ = "$DEBUG" THEN
IF vWatchOn THEN
a$ = "Duplicate $DEBUG metacommand": GOTO errmes
END IF
layout$ = SCase$("$Debug") 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 GOTO finishednonexec
END IF END IF
@ -11427,6 +11440,11 @@ FOR x = 1 TO commonarraylistn
NEXT NEXT
IF Debug THEN PRINT #9, "Finished COMMON array list check!" IF Debug THEN PRINT #9, "Finished COMMON array list check!"
IF vWatchDesiredState <> vWatchOn THEN
vWatchRecompileAttempts = vWatchRecompileAttempts + 1
recompile = 1
END IF
IF recompile THEN IF recompile THEN
do_recompile: do_recompile:
IF Debug THEN PRINT #9, "Recompile required!" IF Debug THEN PRINT #9, "Recompile required!"

View file

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