From bf9ab3458c8b847e38186ff7bae5b99c68aafeb9 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Sun, 22 Aug 2021 11:49:48 -0300 Subject: [PATCH] Allows outputting the watch list to the console. --- internal/support/vwatch/vwatch.bm | 3 +- source/global/IDEsettings.bas | 35 +++++---- source/ide/ide_global.bas | 2 +- source/ide/ide_methods.bas | 113 +++++++++++++++++------------- 4 files changed, 85 insertions(+), 68 deletions(-) diff --git a/internal/support/vwatch/vwatch.bm b/internal/support/vwatch/vwatch.bm index 117ae27f2..c6646a601 100644 --- a/internal/support/vwatch/vwatch.bm +++ b/internal/support/vwatch/vwatch.bm @@ -261,7 +261,7 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET) vw_arrayIndex = CVL(MID$(vw_value$, 10, 4)) vw_elementoffset = _CV(_OFFSET, MID$(vw_value$, 14, LEN(vw_elementoffset))) vw_varSize = CVL(MID$(vw_value$, 14 + LEN(vw_elementoffset), 4)) - IF vw_varSize = 0 THEN PRINT "NoSize": GOTO cmdProcessingDone + IF vw_varSize = 0 THEN GOTO cmdProcessingDone vw_i = CVI(MID$(vw_value$, 18 + LEN(vw_elementoffset), 2)) IF vw_i THEN vw_scope$ = MID$(vw_value$, 20 + LEN(vw_elementoffset), vw_i) @@ -316,7 +316,6 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET) END IF 'vw_address now points to the actual data - PRINT "vw_elementoffset =" ; vw_elementoffset vw_address = vw_address + vw_elementoffset vw_buf$ = SPACE$(vw_varSize) vw_m = _MEM(vw_address, vw_varSize) diff --git a/source/global/IDEsettings.bas b/source/global/IDEsettings.bas index 4fbb771ce..024566b63 100644 --- a/source/global/IDEsettings.bas +++ b/source/global/IDEsettings.bas @@ -14,10 +14,10 @@ DIM SHARED ShowLineNumbersSeparator AS _BYTE, ShowLineNumbersUseBG AS _BYTE DIM SHARED IgnoreWarnings AS _BYTE, qb64versionprinted AS _BYTE DIM SHARED DisableSyntaxHighlighter AS _BYTE, ExeToSourceFolderFirstTimeMsg AS _BYTE DIM SHARED WhiteListQB64FirstTimeMsg AS _BYTE, ideautolayoutkwcapitals AS _BYTE -'DIM SHARED IdeAutoComplete AS _BYTE +DIM SHARED WatchListToConsole AS _BYTE DIM SHARED windowSettingsSection$, colorSettingsSection$, customDictionarySection$ DIM SHARED mouseSettingsSection$, generalSettingsSection$, displaySettingsSection$ -DIM SHARED colorSchemesSection$, iniFolderIndex$, DebugInfoIniWarning$, ConfigFile$ +DIM SHARED colorSchemesSection$, debugSettingsSection$, iniFolderIndex$, DebugInfoIniWarning$, ConfigFile$ DIM SHARED idebaseTcpPort AS LONG windowSettingsSection$ = "IDE WINDOW" @@ -27,6 +27,7 @@ customDictionarySection$ = "CUSTOM DICTIONARIES" mouseSettingsSection$ = "MOUSE SETTINGS" generalSettingsSection$ = "GENERAL SETTINGS" displaySettingsSection$ = "IDE DISPLAY SETTINGS" +debugSettingsSection$ = "DEBUG SETTINGS" ConfigFile$ = "internal/config.ini" iniFolderIndex$ = STR$(tempfolderindex) @@ -203,26 +204,10 @@ ELSE WriteConfigSetting generalSettingsSection$, "IgnoreWarnings", "False" END IF -'IF ReadConfigSetting(generalSettingsSection$, "IdeAutoComplete", value$) THEN -' IF UCASE$(value$) = "TRUE" OR ABS(VAL(value$)) = 1 THEN -' IdeAutoComplete = -1 -' ELSE -' IdeAutoComplete = 0 -' WriteConfigSetting generalSettingsSection$, "IdeAutoComplete", "False" -' END IF -'ELSE -' IdeAutoComplete = -1 -' WriteConfigSetting generalSettingsSection$, "IdeAutoComplete", "True" -'END IF - result = ReadConfigSetting(generalSettingsSection$, "BackupSize", value$) idebackupsize = VAL(value$) IF idebackupsize < 10 OR idebackupsize > 2000 THEN idebackupsize = 100: WriteConfigSetting generalSettingsSection$, "BackupSize", "100 'in MB" -result = ReadConfigSetting(generalSettingsSection$, "BaseTCPPort", value$) -idebaseTcpPort = VAL(value$) -IF idebaseTcpPort = 0 THEN idebaseTcpPort = 9000: WriteConfigSetting generalSettingsSection$, "BaseTCPPort", "9000" - result = ReadConfigSetting(generalSettingsSection$, "DebugInfo", value$) idedebuginfo = VAL(value$) IF UCASE$(LEFT$(value$, 4)) = "TRUE" THEN idedebuginfo = 1 @@ -242,6 +227,20 @@ ELSE WriteConfigSetting mouseSettingsSection$, "SwapMouseButton", "False" END IF +'Debug settings --------------------------------------------------------------- +result = ReadConfigSetting(debugSettingsSection$, "BaseTCPPort", value$) +idebaseTcpPort = VAL(value$) +IF idebaseTcpPort = 0 THEN idebaseTcpPort = 9000: WriteConfigSetting debugSettingsSection$, "BaseTCPPort", "9000" + +result = ReadConfigSetting(debugSettingsSection$, "WatchListToConsole", value$) +IF UCASE$(value$) = "TRUE" OR VAL(value$) = -1 THEN + WatchListToConsole = -1 + WriteConfigSetting debugSettingsSection$, "WatchListToConsole", "True" +ELSE + WatchListToConsole = 0 + WriteConfigSetting debugSettingsSection$, "WatchListToConsole", "False" +END IF + 'Display settings ------------------------------------------------------------- IF ReadConfigSetting(displaySettingsSection$, "IDE_SortSUBs", value$) THEN IF UCASE$(value$) = "TRUE" OR VAL(value$) = -1 THEN diff --git a/source/ide/ide_global.bas b/source/ide/ide_global.bas index b63ff18f4..40c3c9f48 100644 --- a/source/ide/ide_global.bas +++ b/source/ide/ide_global.bas @@ -221,7 +221,7 @@ DIM SHARED ViewMenuID AS INTEGER, ViewMenuShowLineNumbersSubMenuID AS INTEGER DIM SHARED ViewMenuShowSeparatorID AS INTEGER, ViewMenuShowBGID AS INTEGER DIM SHARED ViewMenuCompilerWarnings AS INTEGER DIM SHARED RunMenuID AS INTEGER, RunMenuSaveExeWithSource AS INTEGER, brackethighlight AS INTEGER -DIM SHARED DebugMenuID AS INTEGER, DebugMenuCallStack AS INTEGER +DIM SHARED DebugMenuID AS INTEGER, DebugMenuCallStack AS INTEGER, DebugMenuWatchListToConsole AS INTEGER DIM SHARED multihighlight AS INTEGER, keywordHighlight AS INTEGER DIM SHARED PresetColorSchemes AS INTEGER, TotalColorSchemes AS INTEGER, ColorSchemes$(0) DIM SHARED LastValidColorScheme AS INTEGER diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 2a32bfeb8..06ae1670d 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -357,6 +357,12 @@ FUNCTION ide2 (ignore) menu$(DebugMenuID, DebugMenuCallStack) = "Call #Stack... F12": i = i + 1 menuDesc$(m, i - 1) = "Displays the call stack of the current program's last execution" menu$(m, i) = "-": i = i + 1 + DebugMenuWatchListToConsole = i + menu$(m, i) = "#Output Watch List to Console": i = i + 1 + menuDesc$(m, i - 1) = "Toggles directing the output of the watch list to the console window" + IF WatchListToConsole THEN + menu$(DebugMenuID, DebugMenuWatchListToConsole) = CHR$(7) + menu$(DebugMenuID, DebugMenuWatchListToConsole) + END IF menu$(m, i) = "Set Base #TCP/IP Port Number...": i = i + 1 menuDesc$(m, i - 1) = "Sets the initial port number for TCP/IP communication with the debuggee" menu$(m, i) = "#Advanced (C++)...": i = i + 1 @@ -755,6 +761,7 @@ FUNCTION ide2 (ignore) ready = 1 _RESIZE OFF DebugMode + IF WatchListToConsole THEN _CONSOLE OFF UpdateMenuHelpLine "" SELECT CASE IdeDebugMode CASE 1 'clean exit @@ -4954,22 +4961,6 @@ FUNCTION ide2 (ignore) GOTO ideloop END IF - 'IF RIGHT$(menu$(m, s), 17) = "Code Suggest#ions" THEN - ' PCOPY 2, 0 - ' IF IdeAutoComplete = 0 THEN - ' IdeAutoComplete = -1 - ' WriteConfigSetting generalSettingsSection$, "IdeAutoComplete", "True" - ' menu$(OptionsMenuID, OptionsMenuAutoComplete) = CHR$(7) + "Code Suggest#ions" - ' ELSE - ' IdeAutoComplete = 0 - ' WriteConfigSetting generalSettingsSection$, "IdeAutoComplete", "False" - ' menu$(OptionsMenuID, OptionsMenuAutoComplete) = "Code Suggest#ions" - ' END IF - ' idechangemade = 1 - ' PCOPY 3, 0: SCREEN , , 3, 0 - ' GOTO ideloop - 'END IF - IF RIGHT$(menu$(m, s), 28) = "Output EXE to Source #Folder" THEN PCOPY 2, 0 SaveExeWithSource = NOT SaveExeWithSource @@ -4985,6 +4976,21 @@ FUNCTION ide2 (ignore) GOTO ideloop END IF + IF RIGHT$(menu$(m, s), 29) = "#Output Watch List to Console" THEN + PCOPY 2, 0 + WatchListToConsole = NOT WatchListToConsole + IF WatchListToConsole THEN + WriteConfigSetting debugSettingsSection$, "WatchListToConsole", "True" + menu$(DebugMenuID, DebugMenuWatchListToConsole) = CHR$(7) + "#Output Watch List to Console" + ELSE + WriteConfigSetting debugSettingsSection$, "WatchListToConsole", "False" + menu$(DebugMenuID, DebugMenuWatchListToConsole) = "#Output Watch List to Console" + END IF + PCOPY 3, 0: SCREEN , , 3, 0 + GOTO ideloop + END IF + + IF MID$(menu$(m, s), 1, 17) = "#Quick Navigation" OR MID$(menu$(m, s), 2, 17) = "#Quick Navigation" THEN PCOPY 2, 0 EnableQuickNav = NOT EnableQuickNav @@ -7553,7 +7559,10 @@ SUB DebugMode ideshowtext UpdateTitleOfMainWindow - IF PauseMode <> 0 AND LEN(variableWatchList$) > 0 THEN showvWatchPanel vWatchPanel, currentSub$, totalVisibleVariables + IF PauseMode <> 0 AND LEN(variableWatchList$) > 0 THEN + IF WatchListToConsole THEN _CONSOLE ON + showvWatchPanel vWatchPanel, currentSub$, totalVisibleVariables + END IF PCOPY 3, 0 RETURN @@ -7622,17 +7631,21 @@ SUB showvWatchPanel (this AS vWatchPanelType, currentScope$, totalVisibleVariabl IF this.x + this.w + 2 > idewx THEN this.x = idewx - (this.w + 2) END IF - COLOR fg, bg - ideboxshadow this.x, this.y, this.w, this.h - COLOR 15, bg - _PRINTSTRING (this.x + this.w - 1, this.y + this.h - 1), CHR$(254) 'resize handle + IF WatchListToConsole = 0 THEN + COLOR fg, bg + ideboxshadow this.x, this.y, this.w, this.h + COLOR 15, bg + _PRINTSTRING (this.x + this.w - 1, this.y + this.h - 1), CHR$(254) 'resize handle - x = LEN(title$) + 2 - COLOR fg, bg - _PRINTSTRING (this.x + (this.w \ 2) - (x - 1) \ 2, this.y), " " + title$ + " " - COLOR 15, 4 - _PRINTSTRING (this.x + this.w - 3, this.y), " x " 'close button - COLOR , bg + x = LEN(title$) + 2 + COLOR fg, bg + _PRINTSTRING (this.x + (this.w \ 2) - (x - 1) \ 2, this.y), " " + title$ + " " + COLOR 15, 4 + _PRINTSTRING (this.x + this.w - 3, this.y), " x " 'close button + COLOR , bg + ELSE + _ECHO "-------- " + title$ + END IF y = 0 i = 0 @@ -7644,9 +7657,9 @@ SUB showvWatchPanel (this AS vWatchPanelType, currentScope$, totalVisibleVariabl tempArrayIndex& = CVL(MID$(temp$, 5, 4)) temp$ = MID$(temp$, 9) i = i + 1 - IF this.firstVisible > i THEN _CONTINUE + IF this.firstVisible > i AND WatchListToConsole <> 0 THEN _CONTINUE y = y + 1 - IF y > this.h - 2 THEN EXIT DO + IF y > this.h - 2 AND WatchListToConsole <> 0 THEN EXIT DO thisName$ = usedVariableList(tempIndex&).name IF usedVariableList(tempIndex&).isarray THEN @@ -7675,30 +7688,36 @@ SUB showvWatchPanel (this AS vWatchPanelType, currentScope$, totalVisibleVariabl COLOR fg ELSE item$ = item$ + "" - COLOR 2 + IF WatchListToConsole = 0 THEN COLOR 2 END IF IF LEN(item$) > this.contentWidth THEN this.contentWidth = LEN(item$) - _PRINTSTRING (this.x + 2, this.y + y), MID$(item$, this.hPos, this.w - 4) + IF WatchListToConsole = 0 THEN + _PRINTSTRING (this.x + 2, this.y + y), MID$(item$, this.hPos, this.w - 4) + ELSE + _ECHO item$ + END IF LOOP - IF totalVisibleVariables > this.h - 2 THEN - y = idevbar(this.x + this.w - 1, this.y + 1, this.h - 2, this.firstVisible, totalVisibleVariables - (this.h - 2) + 1) - IF this.draggingVBar = 0 THEN - this.vBarThumb = y + IF WatchListToConsole = 0 THEN + IF totalVisibleVariables > this.h - 2 THEN + y = idevbar(this.x + this.w - 1, this.y + 1, this.h - 2, this.firstVisible, totalVisibleVariables - (this.h - 2) + 1) + IF this.draggingVBar = 0 THEN + this.vBarThumb = y + END IF + ELSE + this.vBarThumb = 0 + this.firstVisible = 1 END IF - ELSE - this.vBarThumb = 0 - this.firstVisible = 1 - END IF - IF this.contentWidth > this.w - 4 THEN - x = idehbar(this.x, this.y + this.h - 1, this.w - 1, this.hPos, this.contentWidth - (this.w - 4) + 1) - IF this.draggingHBar = 0 THEN - this.hBarThumb = x + IF this.contentWidth > this.w - 4 THEN + x = idehbar(this.x, this.y + this.h - 1, this.w - 1, this.hPos, this.contentWidth - (this.w - 4) + 1) + IF this.draggingHBar = 0 THEN + this.hBarThumb = x + END IF + ELSE + this.hBarThumb = 0 + this.hPos = 1 END IF - ELSE - this.hBarThumb = 0 - this.hPos = 1 END IF END SUB @@ -13490,7 +13509,7 @@ SUB ideSetTCPPortBox idebaseTcpPort = VAL(v$) IF idebaseTcpPort = 0 THEN idebaseTcpPort = 9000 - WriteConfigSetting generalSettingsSection$, "BaseTCPPort", str2$(idebaseTcpPort) + WriteConfigSetting debugSettingsSection$, "BaseTCPPort", str2$(idebaseTcpPort) END SUB FUNCTION idegetlinenumberbox(title$, initialValue&)