1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-07 15:40:24 +00:00

Merge branch 'var-export' into development

This commit is contained in:
Fellippe Heitor 2021-07-22 18:41:17 -03:00
commit 26863b64c5
11 changed files with 3965 additions and 64 deletions

View file

@ -0,0 +1,20 @@
'$COLOR:0
'Color constants for text mode.
CONST Black~%% = 0
CONST Blue~%% = 1
CONST Green~%% = 2
CONST Cyan~%% = 3
CONST Red~%% = 4
CONST Magenta~%% = 5
CONST Brown~%% = 6
CONST White~%% = 7
CONST Gray~%% = 8
CONST LightBlue~%% = 9
CONST LightGreen~%% = 10
CONST LightCyan~%% = 11
CONST LightRed~%% = 12
CONST LightMagenta~%% = 13
CONST Yellow~%% = 14
CONST BrightWhite~%% = 15
CONST Blink~%% = 16

View file

@ -0,0 +1,272 @@
'$COLOR:32
'Color constants for 32bit mode, based on HTML color names.
CONST AliceBlue~& = 4293982463
CONST Almond~& = 4293910221
CONST AntiqueBrass~& = 4291663221
CONST AntiqueWhite~& = 4294634455
CONST Apricot~& = 4294826421
CONST Aqua~& = 4278255615
CONST Aquamarine~& = 4286578644
CONST Asparagus~& = 4287080811
CONST AtomicTangerine~& = 4294943860
CONST Azure~& = 4293984255
CONST BananaMania~& = 4294633397
CONST Beaver~& = 4288643440
CONST Beige~& = 4294309340
CONST Bisque~& = 4294960324
CONST Bittersweet~& = 4294802542
CONST Black~& = 4278190080
CONST BlanchedAlmond~& = 4294962125
CONST BlizzardBlue~& = 4289521134
CONST Blue~& = 4278190335
CONST BlueBell~& = 4288848592
CONST BlueGray~& = 4284914124
CONST BlueGreen~& = 4279081146
CONST BlueViolet~& = 4287245282
CONST Blush~& = 4292763011
CONST BrickRed~& = 4291510612
CONST Brown~& = 4289014314
CONST BurlyWood~& = 4292786311
CONST BurntOrange~& = 4294934345
CONST BurntSienna~& = 4293557853
CONST CadetBlue~& = 4284456608
CONST Canary~& = 4294967193
CONST CaribbeanGreen~& = 4280079266
CONST CarnationPink~& = 4294945484
CONST Cerise~& = 4292691090
CONST Cerulean~& = 4280134870
CONST ChartReuse~& = 4286578432
CONST Chestnut~& = 4290534744
CONST Chocolate~& = 4291979550
CONST Copper~& = 4292711541
CONST Coral~& = 4294934352
CONST Cornflower~& = 4288335595
CONST CornflowerBlue~& = 4284782061
CONST Cornsilk~& = 4294965468
CONST CottonCandy~& = 4294950105
CONST CrayolaAquamarine~& = 4286110690
CONST CrayolaBlue~& = 4280251902
CONST CrayolaBlueViolet~& = 4285753021
CONST CrayolaBrown~& = 4290013005
CONST CrayolaCadetBlue~& = 4289771462
CONST CrayolaForestGreen~& = 4285378177
CONST CrayolaGold~& = 4293379735
CONST CrayolaGoldenrod~& = 4294760821
CONST CrayolaGray~& = 4287992204
CONST CrayolaGreen~& = 4280069240
CONST CrayolaGreenYellow~& = 4293978257
CONST CrayolaIndigo~& = 4284315339
CONST CrayolaLavender~& = 4294751445
CONST CrayolaMagenta~& = 4294337711
CONST CrayolaMaroon~& = 4291311706
CONST CrayolaMidnightBlue~& = 4279912566
CONST CrayolaOrange~& = 4294931768
CONST CrayolaOrangeRed~& = 4294912811
CONST CrayolaOrchid~& = 4293306583
CONST CrayolaPlum~& = 4287513989
CONST CrayolaRed~& = 4293795917
CONST CrayolaSalmon~& = 4294941610
CONST CrayolaSeaGreen~& = 4288668351
CONST CrayolaSilver~& = 4291675586
CONST CrayolaSkyBlue~& = 4286634731
CONST CrayolaSpringGreen~& = 4293716670
CONST CrayolaTann~& = 4294616940
CONST CrayolaThistle~& = 4293642207
CONST CrayolaViolet~& = 4287786670
CONST CrayolaYellow~& = 4294764675
CONST CrayolaYellowGreen~& = 4291158916
CONST Crimson~& = 4292613180
CONST Cyan~& = 4278255615
CONST Dandelion~& = 4294826861
CONST DarkBlue~& = 4278190219
CONST DarkCyan~& = 4278225803
CONST DarkGoldenRod~& = 4290283019
CONST DarkGray~& = 4289309097
CONST DarkGreen~& = 4278215680
CONST DarkKhaki~& = 4290623339
CONST DarkMagenta~& = 4287299723
CONST DarkOliveGreen~& = 4283788079
CONST DarkOrange~& = 4294937600
CONST DarkOrchid~& = 4288230092
CONST DarkRed~& = 4287299584
CONST DarkSalmon~& = 4293498490
CONST DarkSeaGreen~& = 4287609999
CONST DarkSlateBlue~& = 4282924427
CONST DarkSlateGray~& = 4281290575
CONST DarkTurquoise~& = 4278243025
CONST DarkViolet~& = 4287889619
CONST DeepPink~& = 4294907027
CONST DeepSkyBlue~& = 4278239231
CONST Denim~& = 4281035972
CONST DesertSand~& = 4293905848
CONST DimGray~& = 4285098345
CONST DodgerBlue~& = 4280193279
CONST Eggplant~& = 4285419872
CONST ElectricLime~& = 4291755805
CONST Fern~& = 4285643896
CONST FireBrick~& = 4289864226
CONST Floralwhite~& = 4294966000
CONST ForestGreen~& = 4280453922
CONST Fuchsia~& = 4290995397
CONST FuzzyWuzzy~& = 4291585638
CONST Gainsboro~& = 4292664540
CONST GhostWhite~& = 4294506751
CONST Gold~& = 4294956800
CONST GoldenRod~& = 4292519200
CONST GrannySmithApple~& = 4289258656
CONST Gray~& = 4286611584
CONST Green~& = 4278222848
CONST GreenBlue~& = 4279329972
CONST GreenYellow~& = 4289593135
CONST HoneyDew~& = 4293984240
CONST HotMagenta~& = 4294909390
CONST HotPink~& = 4294928820
CONST Inchworm~& = 4289915997
CONST IndianRed~& = 4291648604
CONST Indigo~& = 4283105410
CONST Ivory~& = 4294967280
CONST JazzberryJam~& = 4291442535
CONST JungleGreen~& = 4282101903
CONST Khaki~& = 4293977740
CONST LaserLemon~& = 4294901282
CONST Lavender~& = 4293322490
CONST LavenderBlush~& = 4294963445
CONST LawnGreen~& = 4286381056
CONST LemonChiffon~& = 4294965965
CONST LemonYellow~& = 4294964303
CONST LightBlue~& = 4289583334
CONST LightCoral~& = 4293951616
CONST LightCyan~& = 4292935679
CONST LightGoldenRodYellow~& = 4294638290
CONST LightGray~& = 4292072403
CONST LightGreen~& = 4287688336
CONST LightPink~& = 4294948545
CONST LightSalmon~& = 4294942842
CONST LightSeaGreen~& = 4280332970
CONST LightSkyBlue~& = 4287090426
CONST LightSlateGray~& = 4286023833
CONST LightSteelBlue~& = 4289774814
CONST LightYellow~& = 4294967264
CONST Lime~& = 4278255360
CONST LimeGreen~& = 4281519410
CONST Linen~& = 4294635750
CONST MacaroniAndCheese~& = 4294950280
CONST Magenta~& = 4294902015
CONST MagicMint~& = 4289392849
CONST Mahogany~& = 4291643980
CONST Maize~& = 4293775772
CONST Manatee~& = 4288125610
CONST MangoTango~& = 4294935107
CONST Maroon~& = 4286578688
CONST Mauvelous~& = 4293892266
CONST MediumAquamarine~& = 4284927402
CONST MediumBlue~& = 4278190285
CONST MediumOrchid~& = 4290401747
CONST MediumPurple~& = 4287852763
CONST MediumSeaGreen~& = 4282168177
CONST MediumSlateBlue~& = 4286277870
CONST MediumSpringGreen~& = 4278254234
CONST MediumTurquoise~& = 4282962380
CONST MediumVioletRed~& = 4291237253
CONST Melon~& = 4294818996
CONST MidnightBlue~& = 4279834992
CONST MintCream~& = 4294311930
CONST MistyRose~& = 4294960353
CONST Moccasin~& = 4294960309
CONST MountainMeadow~& = 4281383567
CONST Mulberry~& = 4291120012
CONST NavajoWhite~& = 4294958765
CONST Navy~& = 4278190208
CONST NavyBlue~& = 4279858386
CONST NeonCarrot~& = 4294943555
CONST OldLace~& = 4294833638
CONST Olive~& = 4286611456
CONST OliveDrab~& = 4285238819
CONST OliveGreen~& = 4290426988
CONST Orange~& = 4294944000
CONST OrangeRed~& = 4294919424
CONST OrangeYellow~& = 4294497640
CONST Orchid~& = 4292505814
CONST OuterSpace~& = 4282468940
CONST OutrageousOrange~& = 4294929994
CONST PacificBlue~& = 4280068553
CONST PaleGoldenRod~& = 4293847210
CONST PaleGreen~& = 4288215960
CONST PaleTurquoise~& = 4289720046
CONST PaleVioletRed~& = 4292571283
CONST PapayaWhip~& = 4294963157
CONST Peach~& = 4294954923
CONST PeachPuff~& = 4294957753
CONST Periwinkle~& = 4291154150
CONST Peru~& = 4291659071
CONST PiggyPink~& = 4294827494
CONST PineGreen~& = 4279599224
CONST Pink~& = 4294951115
CONST PinkFlamingo~& = 4294735101
CONST PinkSherbet~& = 4294414247
CONST Plum~& = 4292714717
CONST PowderBlue~& = 4289781990
CONST Purple~& = 4286578816
CONST PurpleHeart~& = 4285809352
CONST PurpleMountainsMajesty~& = 4288512442
CONST PurplePizzazz~& = 4294856410
CONST RadicalRed~& = 4294920556
CONST RawSienna~& = 4292250201
CONST RawUmber~& = 4285614883
CONST RazzleDazzleRose~& = 4294920400
CONST Razzmatazz~& = 4293076331
CONST Red~& = 4294901760
CONST RedOrange~& = 4294923081
CONST RedViolet~& = 4290790543
CONST RobinsEggBlue~& = 4280274635
CONST RosyBrown~& = 4290547599
CONST RoyalBlue~& = 4282477025
CONST RoyalPurple~& = 4286075305
CONST SaddleBrown~& = 4287317267
CONST Salmon~& = 4294606962
CONST SandyBrown~& = 4294222944
CONST Scarlet~& = 4294715463
CONST ScreaminGreen~& = 4285988730
CONST SeaGreen~& = 4281240407
CONST SeaShell~& = 4294964718
CONST Sepia~& = 4289030479
CONST Shadow~& = 4287265117
CONST Shamrock~& = 4282764962
CONST ShockingPink~& = 4294672125
CONST Sienna~& = 4288696877
CONST Silver~& = 4290822336
CONST SkyBlue~& = 4287090411
CONST SlateBlue~& = 4285160141
CONST SlateGray~& = 4285563024
CONST Snow~& = 4294966010
CONST SpringGreen~& = 4278255487
CONST SteelBlue~& = 4282811060
CONST Sunglow~& = 4294954824
CONST SunsetOrange~& = 4294794835
CONST Tann~& = 4291998860
CONST Teal~& = 4278222976
CONST TealBlue~& = 4279805877
CONST Thistle~& = 4292394968
CONST TickleMePink~& = 4294740396
CONST Timberwolf~& = 4292597714
CONST Tomato~& = 4294927175
CONST TropicalRainForest~& = 4279730285
CONST Tumbleweed~& = 4292782728
CONST Turquoise~& = 4282441936
CONST TurquoiseBlue~& = 4286045671
CONST UnmellowYellow~& = 4294967142
CONST Violet~& = 4293821166
CONST VioletBlue~& = 4281486002
CONST VioletRed~& = 4294398868
CONST VividTangerine~& = 4294942857
CONST VividViolet~& = 4287582365
CONST Wheat~& = 4294303411
CONST White~& = 4294967295
CONST Whitesmoke~& = 4294309365
CONST WildBlueYonder~& = 4288851408
CONST WildStrawberry~& = 4294919076
CONST WildWatermelon~& = 4294732933
CONST Wisteria~& = 4291667166
CONST Yellow~& = 4294967040
CONST YellowGreen~& = 4288335154
CONST YellowOrange~& = 4294946370

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,14 @@
$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

@ -0,0 +1,285 @@
$CHECKING:OFF
SUB vwatch (localVariables AS _OFFSET)
STATIC AS LONG ideHost, breakpointCount, skipCount, timeout, startLevel, lastLine
STATIC AS LONG callStackLength, runToLine
STATIC AS _BYTE pauseMode, stepOver, bypass, setNextLine
STATIC buffer$, endc$
DIM AS LONG i
DIM AS _OFFSET address
DIM AS _MEM m
DIM start!, temp$, cmd$, value$, k&
DECLARE LIBRARY
SUB vwatch_stoptimers ALIAS stop_timers
SUB vwatch_starttimers ALIAS start_timers
SUB unlockvWatchHandle
END DECLARE
IF bypass THEN EXIT SUB
vwatch_goto = 0
IF ideHost = 0 THEN
timeout = 10
endc$ = "<END>"
'initial setup
GOSUB Connect
'send this binary's path/exe name
cmd$ = "me:" + COMMAND$(0)
GOSUB SendCommand
DO
GOSUB GetCommand
SELECT CASE cmd$
CASE "vwatch"
IF value$ <> "ok" THEN
unlockvWatchHandle: CLOSE #ideHost
bypass = -1
EXIT SUB
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"
IF LEN(value$) \ 4 <> breakpointCount THEN
cmd$ = "quit:Communication error."
GOSUB SendCommand
unlockvWatchHandle: CLOSE #ideHost
bypass = -1
EXIT SUB
END IF
FOR i = 1 TO breakpointCount
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
unlockvWatchHandle: CLOSE #ideHost
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
EXIT SUB
CASE "break"
pauseMode = -1
EXIT DO
END SELECT
LOOP
END IF
IF vwatch_linenumber = 0 THEN
GOSUB SendCallStack
cmd$ = "quit:Program ended."
GOSUB SendCommand
unlockvWatchHandle: CLOSE #ideHost
bypass = -1
ideHost = 0
EXIT SUB
ELSEIF vwatch_linenumber = -1 THEN
'report an error in the most recent line
GOSUB SendCallStack
cmd$ = "error:" + MKL$(lastLine)
GOSUB SendCommand
EXIT SUB
ELSEIF vwatch_linenumber = -2 THEN
'report a new sub/function has been "entered"
IF LEN(vwatch_callstack) > 100000 THEN
vwatch_callstack = ""
callStackLength = 0
END IF
callStackLength = callStackLength + 1
IF LEN(vwatch_callstack) THEN vwatch_callstack = vwatch_callstack + CHR$(0)
vwatch_callstack = vwatch_callstack + vwatch_subname$ + ", line" + STR$(lastLine)
EXIT SUB
ELSEIF vwatch_linenumber = -3 THEN
'handle STOP - instead of quitting, pause execution
pauseMode = -1
stepOver = 0
EXIT SUB
END IF
IF vwatch_linenumber = lastLine AND setNextLine = 0 THEN EXIT SUB
setNextLine = 0
lastLine = vwatch_linenumber
GOSUB GetCommand
SELECT CASE cmd$
CASE "break"
pauseMode = -1
stepOver = 0
runToLine = 0
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
CASE "clear all skips"
REDIM vwatch_skiplines(UBOUND(vwatch_skiplines)) 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
stepOver = 0
pauseMode = -1
END IF
IF runToLine > 0 AND runToLine <> vwatch_linenumber THEN
EXIT SUB
ELSEIF runToLine > 0 AND runToLine = vwatch_linenumber THEN
pauseMode = -1
runToLine = 0
END IF
IF vwatch_breakpoints(vwatch_linenumber) = 0 AND pauseMode = 0 THEN
EXIT SUB
END IF
vwatch_stoptimers
cmd$ = "line number:"
IF vwatch_breakpoints(vwatch_linenumber) THEN cmd$ = "breakpoint:"
cmd$ = cmd$ + MKL$(vwatch_linenumber)
GOSUB SendCommand
DO 'main loop
SELECT CASE cmd$
CASE "run"
pauseMode = 0
stepOver = 0
vwatch_starttimers
EXIT SUB
CASE "run to line"
pauseMode = 0
stepOver = 0
runToLine = CVL(value$)
vwatch_starttimers
EXIT SUB
CASE "step"
pauseMode = -1
stepOver = 0
EXIT SUB
CASE "step over"
pauseMode = -1
stepOver = -1
startLevel = vwatch_sublevel
vwatch_starttimers
EXIT SUB
CASE "step out"
pauseMode = -1
stepOver = -1
startLevel = vwatch_sublevel - 1
vwatch_starttimers
EXIT SUB
CASE "free"
unlockvWatchHandle: CLOSE #ideHost
ideHost = 0
bypass = -1
vwatch_starttimers
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"
REDIM vwatch_breakpoints(UBOUND(vwatch_breakpoints)) AS _BYTE
CASE "clear all skips"
REDIM vwatch_skiplines(UBOUND(vwatch_skiplines)) AS _BYTE
CASE "call stack"
'send call stack history"
GOSUB SendCallStack
CASE "local"
i = CVL(value$)
address = localVariables + LEN(address) * i
PRINT "Local"; i; "is at"; _MEMGET(m, address, _OFFSET)
CASE "set next line"
pauseMode = -1
stepOver = 0
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
_LIMIT 100
LOOP
vwatch_starttimers
EXIT SUB
Connect:
DIM ideport$
ideport$ = ENVIRON$("QB64DEBUGPORT")
IF ideport$ = "" THEN bypass = -1: EXIT SUB
start! = TIMER
DO
k& = _KEYHIT
ideHost = _OPENCLIENT("QB64IDE:" + ideport$ + ":localhost")
_LIMIT 30
LOOP UNTIL k& = 27 OR ideHost <> 0 OR TIMER - start! > timeout
IF ideHost = 0 THEN bypass = -1: EXIT SUB
RETURN
GetCommand:
GET #ideHost, , temp$
buffer$ = buffer$ + temp$
IF INSTR(buffer$, endc$) THEN
cmd$ = LEFT$(buffer$, INSTR(buffer$, endc$) - 1)
buffer$ = MID$(buffer$, INSTR(buffer$, endc$) + LEN(endc$))
IF INSTR(cmd$, ":") THEN
value$ = MID$(cmd$, INSTR(cmd$, ":") + 1)
cmd$ = LEFT$(cmd$, INSTR(cmd$, ":") - 1)
ELSE
value$ = ""
END IF
ELSE
cmd$ = "": value$ = ""
END IF
RETURN
SendCallStack:
cmd$ = "call stack size:" + MKL$(callStackLength)
GOSUB SendCommand
cmd$ = "call stack:" + vwatch_callstack
GOSUB SendCommand
RETURN
SendCommand:
cmd$ = cmd$ + endc$
PUT #ideHost, , cmd$
cmd$ = ""
RETURN
END SUB

View file

@ -18,6 +18,7 @@ DIM SHARED WhiteListQB64FirstTimeMsg AS _BYTE, ideautolayoutkwcapitals AS _BYTE
DIM SHARED windowSettingsSection$, colorSettingsSection$, customDictionarySection$
DIM SHARED mouseSettingsSection$, generalSettingsSection$, displaySettingsSection$
DIM SHARED colorSchemesSection$, iniFolderIndex$, DebugInfoIniWarning$, ConfigFile$
DIM SHARED idebaseTcpPort AS LONG
windowSettingsSection$ = "IDE WINDOW"
colorSettingsSection$ = "IDE COLOR SETTINGS"
@ -218,6 +219,10 @@ 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

View file

@ -168,7 +168,7 @@ DIM SHARED EnteringRGB AS _BYTE
DIM SHARED ActiveINCLUDELink AS LONG
DIM SHARED ActiveINCLUDELinkFile AS STRING
DIM SHARED HideCurrentLineHighlight AS _BYTE, ShowLineNumbers AS _BYTE
DIM SHARED SearchMenuEnableQuickNav AS INTEGER
DIM SHARED SearchMenuEnableQuickNav AS INTEGER, searchStringFoundOn AS LONG
DIM SHARED idegotobox_LastLineNum AS LONG, maxLineNumberLength AS LONG
DIM SHARED versionStringStatus$, lineNumberStatus$

View file

@ -344,6 +344,11 @@ FUNCTION ide2 (ignore)
menuDesc$(m, i - 1) = "Removes all breakpoints"
menu$(m, i) = "Toggle #Skip Line Ctrl+P": i = i + 1
menuDesc$(m, i - 1) = "Sets/clears flag to skip line"
menu$(m, i) = "#Unskip All Lines Ctrl+F10": i = i + 1
menuDesc$(m, i - 1) = "Removes all line skip flags"
menu$(m, i) = "-": i = i + 1
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"
menusize(m) = i - 1
m = m + 1: i = 0: OptionsMenuID = m
@ -693,14 +698,19 @@ FUNCTION ide2 (ignore)
IF ideautorun THEN ideautorun = 0: GOTO idemrunspecial
END IF
STATIC attemptToHost AS _BYTE
STATIC AS _BYTE attemptToHost, changingTcpPort
IF vWatchOn = 1 AND attemptToHost = 0 THEN
IF host& = 0 THEN
hostport$ = _TRIM$(STR$(9000 + tempfolderindex))
hostport$ = _TRIM$(STR$(idebaseTcpPort + tempfolderindex))
ENVIRON "QB64DEBUGPORT=" + hostport$
host& = _OPENHOST("TCP/IP:" + hostport$)
attemptToHost = -1
END IF
IF changingTcpPort AND (host& = 0) THEN
result = idemessagebox("$DEBUG MODE", "Cannot receive connections on port" + STR$(idebaseTcpPort) + ".\nCheck your firewall permissions.", "")
PCOPY 3, 0: SCREEN , , 3, 0
END IF
changingTcpPort = 0
END IF
IF c$ = CHR$(254) THEN
@ -714,13 +724,15 @@ FUNCTION ide2 (ignore)
idesubwindow = 0
skipdisplay = 0
IdeSystem = 1
retval = 1: GOSUB redrawItAll
retval = 1
END IF
GOSUB redrawItAll
idecompiling = 0
ready = 1
_RESIZE OFF
DebugMode
UpdateMenuHelpLine ""
SELECT CASE IdeDebugMode
CASE 1 'clean exit
IdeDebugMode = 0
@ -1582,6 +1594,14 @@ FUNCTION ide2 (ignore)
GOTO toggleBreakpoint
END IF
IF KB = KEY_F10 THEN 'clear all breakpoints
IF KCTRL THEN
GOTO unskipAllLines
ELSE
GOTO clearAllBreakpoints
END IF
END IF
IF KB = KEY_F11 THEN 'make exe only
idemexe:
iderunmode = 2
@ -2734,6 +2754,7 @@ FUNCTION ide2 (ignore)
WikiParse a$
IdeSystem = 3
GOSUB redrawItAll
GOTO specialchar
EXIT FOR
@ -5737,6 +5758,7 @@ FUNCTION ide2 (ignore)
GOTO EnterDebugMode
ELSE
PCOPY 3, 0: SCREEN , , 3, 0
clearAllBreakpoints:
REDIM IdeBreakpoints(iden) AS _BYTE
GOTO ideloop
END IF
@ -5766,6 +5788,32 @@ FUNCTION ide2 (ignore)
END IF
END IF
IF menu$(m, s) = "#Unskip All Lines Ctrl+F10" THEN
IF IdeDebugMode = 2 THEN
IdeDebugMode = 15
GOTO EnterDebugMode
ELSE
PCOPY 3, 0: SCREEN , , 3, 0
unskipAllLines:
REDIM IdeSkipLines(iden) AS _BYTE
GOTO ideloop
END IF
END IF
IF menu$(m, s) = "Set Base #TCP/IP Port Number..." THEN
PCOPY 2, 0
bkpidebaseTcpPort = idebaseTcpPort
ideSetTCPPortBox
IF bkpidebaseTcpPort <> idebaseTcpPort THEN
IF host& <> 0 THEN CLOSE host&: host& = 0
attemptToHost = 0
changingTcpPort = -1
idechangemade = 1
END IF
PCOPY 3, 0: SCREEN , , 3, 0
GOTO ideloop
END IF
IF menu$(m, s) = "Set #Next Line Ctrl+G" THEN
IdeDebugMode = 13
GOTO EnterDebugMode
@ -6003,8 +6051,17 @@ FUNCTION ide2 (ignore)
COLOR 7, 1: _PRINTSTRING (idewx - 2, idewy - 4), CHR$(195)
'add status title
IF IdeSystem = 2 THEN COLOR 1, 7 ELSE COLOR 7, 1
_PRINTSTRING ((idewx - 8) / 2, idewy - 4), " Status "
COLOR 7, 1
a$ = STRING$(14, 196)
_PRINTSTRING ((idewx - LEN(a$)) / 2, idewy - 4), a$
IF IdeDebugMode THEN
COLOR 1, 7
a$ = " $DEBUG MODE "
ELSE
IF IdeSystem = 2 THEN COLOR 1, 7 ELSE COLOR 7, 1
a$ = " Status "
END IF
_PRINTSTRING ((idewx - LEN(a$)) / 2, idewy - 4), a$
a$ = idefindtext
tx = 1
@ -6207,7 +6264,7 @@ FUNCTION ide2 (ignore)
END FUNCTION
SUB DebugMode
STATIC PauseMode AS _BYTE
STATIC AS _BYTE PauseMode, noFocusMessage
STATIC client&
STATIC buffer$
STATIC endc$
@ -6217,44 +6274,31 @@ SUB DebugMode
SCREEN , , 3, 0
SELECT CASE IdeDebugMode
SELECT EVERYCASE IdeDebugMode
CASE 1
PauseMode = 0
callStackLength = 0
callstacklist$ = ""
buffer$ = ""
client& = 0
CASE 2
IdeDebugMode = 1
GOTO returnFromContextMenu
CASE 3
IdeDebugMode = 1
GOTO requestCallStack
CASE 4
IdeDebugMode = 1
GOTO requestContinue
CASE 5
IdeDebugMode = 1
GOTO requestStepOut
CASE 6
IdeDebugMode = 1
GOTO requestStepOver
CASE 7
IdeDebugMode = 1
GOTO requestPause
CASE IS > 1
noFocusMessage = NOT noFocusMessage
GOSUB UpdateStatusArea
clearStatusWindow 1
setStatusMessage 1, "Paused.", 2
CASE 2: IdeDebugMode = 1: GOTO returnFromContextMenu
CASE 3: IdeDebugMode = 1: GOTO requestCallStack
CASE 4: IdeDebugMode = 1: GOTO requestContinue
CASE 5: IdeDebugMode = 1: GOTO requestStepOut
CASE 6: IdeDebugMode = 1: GOTO requestStepOver
CASE 7: IdeDebugMode = 1: GOTO requestPause
CASE 8
IdeDebugMode = 1
result = idecy
GOTO requestRunToThisLine
CASE 9
IdeDebugMode = 1
GOTO requestQuit
CASE 10
IdeDebugMode = 1
GOTO requestToggleBreakpoint
CASE 11
IdeDebugMode = 1
GOTO requestClearBreakpoints
CASE 9: IdeDebugMode = 1: GOTO requestQuit
CASE 10: IdeDebugMode = 1: GOTO requestToggleBreakpoint
CASE 11: IdeDebugMode = 1: GOTO requestClearBreakpoints
CASE 12
IdeDebugMode = 1
result = idecy
@ -6263,9 +6307,8 @@ SUB DebugMode
IdeDebugMode = 1
result = idecy
GOTO requestSetNextLine
CASE 14
IdeDebugMode = 1
GOTO requestSubsDialog
CASE 14: IdeDebugMode = 1: GOTO requestSubsDialog
CASE 15: IdeDebugMode = 1: GOTO requestUnskipAllLines
END SELECT
COLOR 0, 7: _PRINTSTRING (1, 1), SPACE$(LEN(menubar$))
@ -6283,7 +6326,7 @@ SUB DebugMode
dummy = DarkenFGBG(0)
clearStatusWindow 1
setStatusMessage 1, "Failed to initiate debug session.", 7
setStatusMessage 2, "Cannot receive connections. Check your firewall permissions.", 2
setStatusMessage 2, "Cannot receive connections on port" + STR$(idebaseTcpPort) + ". Check your firewall permissions.", 2
WHILE _MOUSEINPUT: WEND
EXIT SUB
END IF
@ -6405,7 +6448,7 @@ SUB DebugMode
GOSUB SendCommand
clearStatusWindow 2
setStatusMessage 2, "$DEBUG: Set focus to the IDE to control execution", 15
setStatusMessage 2, "$DEBUG MODE: Set focus to the IDE to control execution", 15
noFocusMessage = -1
@ -6579,22 +6622,25 @@ SUB DebugMode
END IF
UpdateStatusArea:
IF _WINDOWHASFOCUS THEN
IF noFocusMessage THEN
clearStatusWindow 2
clearStatusWindow 3
setStatusMessage 2, "$DEBUG: <F4 = Stack> <F5 = Run> <F6 = Step Out> <F7 = Step Over> <F8 = Step>", 15
setStatusMessage 3, " <F9 = Toggle Breakpoint> <F10 = Clear All Breakpoints> <ESC = Abort>", 15
setStatusMessage 2, "<F4 = Call Stack> <F5 = Run> <F6 = Step Out> <F7 = Step Over> <F8 = Step Into>", 15
setStatusMessage 3, "<F9 = Toggle Breakpoint> <F10 = Clear all breakpoints>", 15
UpdateMenuHelpLine "Right-click the code for more options; hit ESC to abort."
noFocusMessage = 0
END IF
ELSE
IF noFocusMessage = 0 THEN
clearStatusWindow 2
clearStatusWindow 3
setStatusMessage 2, "$DEBUG: Set focus to the IDE to control execution", 15
setStatusMessage 2, "Set focus to the IDE to control execution", 15
noFocusMessage = -1
END IF
END IF
IF IdeDebugMode > 1 THEN RETURN
k& = _KEYHIT
SELECT CASE k&
@ -6761,10 +6807,17 @@ SUB DebugMode
GOSUB UpdateDisplay
END IF
CASE 17408 'F10
requestClearBreakpoints:
REDIM IdeBreakpoints(iden) AS _BYTE
cmd$ = "clear all breakpoints"
GOSUB SendCommand
IF _KEYDOWN(100306) OR _KEYDOWN(100305) THEN
requestUnskipAllLines:
REDIM IdeSkipLines(iden) AS _BYTE
cmd$ = "clear all skips"
GOSUB SendCommand
ELSE
requestClearBreakpoints:
REDIM IdeBreakpoints(iden) AS _BYTE
cmd$ = "clear all breakpoints"
GOSUB SendCommand
END IF
GOSUB UpdateDisplay
CASE 103, 71 'g, G
IF _KEYDOWN(100306) OR _KEYDOWN(100305) THEN
@ -8254,6 +8307,7 @@ SUB idefindagain (showFlags AS _BYTE)
IF x THEN
ideselect = 1
idecx = x: idecy = y
searchStringFoundOn = idecy
ideselectx1 = x + LEN(s$): ideselecty1 = y
IF idefindinvert THEN
@ -9773,6 +9827,10 @@ SUB ideshowtext
IF ShowLineNumbers THEN
IF ShowLineNumbersUseBG THEN COLOR , 6
IF searchStringFoundOn > 0 AND searchStringFoundOn = l THEN
COLOR 13, 5
searchStringFoundOn = 0
END IF
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)
@ -11824,6 +11882,16 @@ SUB idegotobox
ideselect = 0
END SUB
SUB ideSetTCPPortBox
a2$ = str2$(idebaseTcpPort)
v$ = ideinputbox$("Base TCP/IP Port Number", "#Port number for $DEBUG mode", a2$, "0123456789", 45, 5)
IF v$ = "" THEN EXIT SUB
idebaseTcpPort = VAL(v$)
IF idebaseTcpPort = 0 THEN idebaseTcpPort = 9000
WriteConfigSetting generalSettingsSection$, "BaseTCPPort", str2$(idebaseTcpPort)
END SUB
FUNCTION idegetlinenumberbox(title$, initialValue&)
a2$ = str2$(initialValue&)
IF a2$ = "0" THEN a2$ = ""
@ -14483,6 +14551,8 @@ SUB IdeMakeContextualMenu
menuDesc$(m, i - 1) = "Removes all breakpoints"
menu$(m, i) = "Toggle #Skip Line Ctrl+P": i = i + 1
menuDesc$(m, i - 1) = "Sets/clears flag to skip line"
menu$(m, i) = "#Unskip All Lines Ctrl+F10": i = i + 1
menuDesc$(m, i - 1) = "Removes all line skip flags"
menu$(m, i) = "-": i = i + 1
menu$(m, i) = "SUBs... F2": i = i + 1
menuDesc$(m, i - 1) = "Displays a list of SUB/FUNCTION procedures"
@ -15920,7 +15990,7 @@ FUNCTION BinaryFormatCheck% (pathToCheck$, pathSepToCheck$, fileToCheck$)
BinaryFormatCheck% = 1
END IF
ELSE
IF _FILEEXISTS("source/utilities/QB45BIN.bas") = 0 THEN
IF _FILEEXISTS("internal/support/converter/QB45BIN.bas") = 0 THEN
result = idemessagebox("Binary format", "Conversion utility not found. Cannot open QuickBASIC 4.5 binary format.", "")
BinaryFormatCheck% = 1
EXIT FUNCTION
@ -15937,9 +16007,9 @@ FUNCTION BinaryFormatCheck% (pathToCheck$, pathSepToCheck$, fileToCheck$)
_PRINTSTRING (2, idewy - 3), "Preparing to convert..."
PCOPY 3, 0
IF INSTR(_OS$, "WIN") THEN
SHELL _HIDE "qb64 -x source/utilities/QB45BIN.bas -o internal/utilities/QB45BIN"
SHELL _HIDE "qb64 -x internal/support/converter/QB45BIN.bas -o internal/utilities/QB45BIN"
ELSE
SHELL _HIDE "./qb64 -x ./source/utilities/QB45BIN.bas -o ./internal/utilities/QB45BIN"
SHELL _HIDE "./qb64 -x ./internal/support/converter/QB45BIN.bas -o ./internal/utilities/QB45BIN"
END IF
IF _FILEEXISTS(convertUtility$) THEN GOTO ConvertIt
clearStatusWindow 0

View file

@ -119,7 +119,7 @@ TYPE usedVarList
name AS STRING
END TYPE
REDIM SHARED usedVariableList(1000) AS usedVarList, totalVariablesCreated AS LONG
DIM SHARED totalVariablesCreated AS LONG
DIM SHARED bypassNextVariable AS _BYTE
DIM SHARED totalWarnings AS LONG, warningListItems AS LONG, lastWarningHeader AS STRING
DIM SHARED duplicateConstWarning AS _BYTE, warningsissued AS _BYTE
@ -1456,6 +1456,7 @@ SelectCaseCounter = 0
ExecCounter = 0
UserDefineCount = 7
totalVariablesCreated = 0
REDIM SHARED usedVariableList(1000) AS usedVarList
totalWarnings = 0
duplicateConstWarning = 0
emptySCWarning = 0
@ -1651,11 +1652,11 @@ DO
forceIncludeFromRoot$ = ""
IF vWatchOn THEN
addingvWatch = 1
IF firstLine <> 0 THEN forceIncludeFromRoot$ = "source\utilities\vwatch\vwatch.bi"
IF lastLine <> 0 THEN forceIncludeFromRoot$ = "source\utilities\vwatch\vwatch.bm"
IF firstLine <> 0 THEN forceIncludeFromRoot$ = "internal\support\vwatch\vwatch.bi"
IF lastLine <> 0 THEN forceIncludeFromRoot$ = "internal\support\vwatch\vwatch.bm"
ELSE
'IF firstLine <> 0 THEN forceIncludeFromRoot$ = "source\embed\header_stub.bas"
IF lastLine <> 0 THEN forceIncludeFromRoot$ = "source\utilities\vwatch\vwatch_stub.bm"
'IF firstLine <> 0 THEN forceIncludeFromRoot$ = "internal\support\vwatch\vwatch_stub.bi"
IF lastLine <> 0 THEN forceIncludeFromRoot$ = "internal\support\vwatch\vwatch_stub.bm"
END IF
firstLine = 0: lastLine = 0
IF LEN(forceIncludeFromRoot$) THEN GOTO forceInclude_prepass
@ -1699,12 +1700,12 @@ DO
temp$ = LTRIM$(RTRIM$(UCASE$(wholestv$)))
IF temp$ = "$COLOR:0" THEN
addmetainclude$ = getfilepath$(COMMAND$(0)) + "source" + pathsep$ + "utilities" + pathsep$ + "color0.bi"
addmetainclude$ = getfilepath$(COMMAND$(0)) + "internal" + pathsep$ + "support" + pathsep$ + "color" + pathsep$ + "color0.bi"
GOTO finishedlinepp
END IF
IF temp$ = "$COLOR:32" THEN
addmetainclude$ = getfilepath$(COMMAND$(0)) + "source" + pathsep$ + "utilities" + pathsep$ + "color32.bi"
addmetainclude$ = getfilepath$(COMMAND$(0)) + "internal" + pathsep$ + "support" + pathsep$ + "color" + pathsep$ + "color32.bi"
GOTO finishedlinepp
END IF
@ -2873,11 +2874,11 @@ DO
forceIncludeFromRoot$ = ""
IF vWatchOn THEN
addingvWatch = 1
IF firstLine <> 0 THEN forceIncludeFromRoot$ = "source\utilities\vwatch\vwatch.bi"
IF lastLine <> 0 THEN forceIncludeFromRoot$ = "source\utilities\vwatch\vwatch.bm"
IF firstLine <> 0 THEN forceIncludeFromRoot$ = "internal\support\vwatch\vwatch.bi"
IF lastLine <> 0 THEN forceIncludeFromRoot$ = "internal\support\vwatch\vwatch.bm"
ELSE
'IF firstLine <> 0 THEN forceIncludeFromRoot$ = "source\embed\header_stub.bas"
IF lastLine <> 0 THEN forceIncludeFromRoot$ = "source\utilities\vwatch\vwatch_stub.bm"
'IF firstLine <> 0 THEN forceIncludeFromRoot$ = "internal\support\vwatch\vwatch_stub.bi"
IF lastLine <> 0 THEN forceIncludeFromRoot$ = "internal\support\vwatch\vwatch_stub.bm"
END IF
firstLine = 0: lastLine = 0
IF LEN(forceIncludeFromRoot$) THEN GOTO forceInclude
@ -3089,14 +3090,14 @@ DO
IF a3u$ = "$COLOR:0" THEN
layout$ = SCase$("$Color:0")
addmetainclude$ = getfilepath$(COMMAND$(0)) + "source" + pathsep$ + "utilities" + pathsep$ + "color0.bi"
addmetainclude$ = getfilepath$(COMMAND$(0)) + "internal" + pathsep$ + "support" + pathsep$ + "color" + pathsep$ + "color0.bi"
layoutdone = 1
GOTO finishednonexec
END IF
IF a3u$ = "$COLOR:32" THEN
layout$ = SCase$("$Color:32")
addmetainclude$ = getfilepath$(COMMAND$(0)) + "source" + pathsep$ + "utilities" + pathsep$ + "color32.bi"
addmetainclude$ = getfilepath$(COMMAND$(0)) + "internal" + pathsep$ + "support" + pathsep$ + "color" + pathsep$ + "color32.bi"
layoutdone = 1
GOTO finishednonexec
END IF
@ -8926,8 +8927,8 @@ DO
END IF
layoutdone = 1: IF LEN(layout$) THEN layout$ = layout$ + sp + l$ ELSE layout$ = l$
IF vWatchOn = 1 AND NoChecks = 0 THEN
vWatchAddLabel 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;"
vWatchAddLabel linenumber, 0
ELSE
PRINT #12, "close_program=1;"
PRINT #12, "end();"

View file

@ -136,6 +136,8 @@ SUB vwatch (localVariables AS _OFFSET)
vwatch_skiplines(CVL(value$)) = 0
CASE "clear all breakpoints"
REDIM vwatch_breakpoints(UBOUND(vwatch_breakpoints)) AS _BYTE
CASE "clear all skips"
REDIM vwatch_skiplines(UBOUND(vwatch_skiplines)) AS _BYTE
END SELECT
IF vwatch_skiplines(vwatch_linenumber) THEN vwatch_goto = -vwatch_linenumber: EXIT SUB
@ -206,6 +208,8 @@ SUB vwatch (localVariables AS _OFFSET)
vwatch_breakpoints(CVL(value$)) = 0
CASE "clear all breakpoints"
REDIM vwatch_breakpoints(UBOUND(vwatch_breakpoints)) AS _BYTE
CASE "clear all skips"
REDIM vwatch_skiplines(UBOUND(vwatch_skiplines)) AS _BYTE
CASE "call stack"
'send call stack history"
GOSUB SendCallStack