diff --git a/source/ide/ide_global.bas b/source/ide/ide_global.bas index b632ef372..87943c844 100644 --- a/source/ide/ide_global.bas +++ b/source/ide/ide_global.bas @@ -167,6 +167,7 @@ DIM SHARED EnteringRGB AS _BYTE DIM SHARED ActiveINCLUDELink AS LONG DIM SHARED ActiveINCLUDELinkFile AS STRING DIM SHARED HideCurrentLineHighlight AS _BYTE +DIM SHARED idegotobox_LastLineNum AS LONG '-------------------------------------------------------------------------------- TYPE idedbptype x AS LONG diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 61af5be40..a32c22e69 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -500,6 +500,12 @@ FUNCTION ide2 (ignore) LOOP UNTIL asca = 13 lineinput3buffer = "" iden = n: IF n = 0 THEN idet$ = MKL$(0) + MKL$(0): iden = 1 ELSE idet$ = LEFT$(idet$, i2 - 1) + IF ideStartAtLine > 0 AND ideStartAtLine <= iden THEN + idecy = ideStartAtLine + IF idecy - 10 >= 1 THEN idesy = idecy - 10 + idegotobox_LastLineNum = ideStartAtLine + ideStartAtLine = 0 + END IF IdeBmkN = 0 ideerror = 1 ideprogname = f$: _TITLE ideprogname + " - QB64" @@ -2693,7 +2699,11 @@ FUNCTION ide2 (ignore) PCOPY 3, 0 _DELAY .2 - SHELL QuotedFilename$(COMMAND$(0)) + " " + QuotedFilename$(f$) + p$ = QuotedFilename$(COMMAND$(0)) + " " + QuotedFilename$(f$) + IF errorLineInInclude > 0 AND idefocusline = idecy THEN + p$ = p$ + " -l:" + str2$(errorLineInInclude) + END IF + SHELL p$ IF IDE_AutoPosition THEN WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_AutoPosition", "TRUE" @@ -10522,8 +10532,6 @@ FUNCTION idemodifycommandbox END FUNCTION FUNCTION idegotobox - STATIC idegotobox_LastLineNum AS LONG - '-------- generic dialog box header -------- PCOPY 0, 2 PCOPY 0, 1 diff --git a/source/qb64.bas b/source/qb64.bas index 0d8bbff20..c257feb6a 100644 --- a/source/qb64.bas +++ b/source/qb64.bas @@ -338,6 +338,7 @@ DIM SHARED idemessage AS STRING 'set by qb64-error(...) to the error message to DIM SHARED optionexplicit AS _BYTE DIM SHARED optionexplicit_cmd AS _BYTE +DIM SHARED ideStartAtLine AS LONG, errorLineInInclude AS LONG DIM SHARED outputfile_cmd$ DIM SHARED compilelog$ @@ -1499,6 +1500,7 @@ layout = "" layoutok = 0 NoChecks = 0 inclevel = 0 +errorLineInInclude = 0 addmetainclude$ = "" nextrunlineindex = 1 lasttype = 0 @@ -2782,6 +2784,7 @@ DO wholeline$ = x$ inclinenumber(inclevel) = inclinenumber(inclevel) + 1 'create extended error string 'incerror$' + errorLineInInclude = inclinenumber(inclevel) e$ = " in line " + str2(inclinenumber(inclevel)) + " of " + incname$(inclevel) + " included" IF inclevel > 1 THEN e$ = e$ + " (through " @@ -10720,6 +10723,7 @@ DO continuelinefrom = 0 inclinenumber(inclevel) = inclinenumber(inclevel) + 1 'create extended error string 'incerror$' + errorLineInInclude = inclinenumber(inclevel) e$ = " in line " + str2(inclinenumber(inclevel)) + " of " + incname$(inclevel) + " included" IF inclevel > 1 THEN e$ = e$ + " (through " @@ -12663,16 +12667,12 @@ FUNCTION ParseCMDLineArgs$ () 'in which case they're simply asking for trouble). FOR i = 1 TO _COMMANDCOUNT token$ = COMMAND$(i) + IF LCASE$(token$) = "-help" OR LCASE$(token$) = "/help" THEN token$ = "-?" SELECT CASE LCASE$(LEFT$(token$, 2)) - CASE "/?", "-?", "-h" 'Command-line help + CASE "-?", "/?" 'Command-line help _DEST _CONSOLE PRINT "QB64 COMPILER V" + Version$ PRINT - IF LCASE$(token$) <> "-help" AND LCASE$(token$) <> "-h" AND token$ <> "-?" AND token$ <> "/?" THEN - 'Ended up being a filename? - PassedFileName$ = token$ - GOTO NextCase - END IF PRINT "USAGE: qb64 [switches] " PRINT PRINT "OPTIONS:" @@ -12681,42 +12681,41 @@ FOR i = 1 TO _COMMANDCOUNT PRINT " -x Compile instead of edit and output the result to the" PRINT " console" PRINT " -z Generate C code without compiling to executable" - 'PRINT " -g Non-GUI environment (uses $CONSOLE:ONLY - for G-WAN" - 'PRINT " compilation)" PRINT " -o Write output executable to " PRINT " -e Enables OPTION _EXPLICIT, making variable declaration" PRINT " mandatory (per-compilation; doesn't affect the" PRINT " source file or global settings)" PRINT " -s[:switch=true/false] View/edit compiler settings" + PRINT " -l: Starts the IDE at the specified line number" PRINT SYSTEM - CASE "-s" 'Settings + CASE "-s", "/s" 'Settings _DEST _CONSOLE PRINT "QB64 COMPILER V" + Version$ - SELECT CASE LCASE$(token$) - CASE "-s" + SELECT CASE LCASE$(MID$(token$, 3)) + CASE "" PRINT "debuginfo = "; IF idedebuginfo THEN PRINT "TRUE" ELSE PRINT "FALSE" PRINT "exewithsource = "; IF SaveExeWithSource THEN PRINT "TRUE" ELSE PRINT "FALSE" SYSTEM - CASE "-s:exewithsource" + CASE ":exewithsource" PRINT "exewithsource = "; IF SaveExeWithSource THEN PRINT "TRUE" ELSE PRINT "FALSE" SYSTEM - CASE "-s:exewithsource=true" + CASE ":exewithsource=true" WriteConfigSetting "'[GENERAL SETTINGS]", "SaveExeWithSource", "TRUE" PRINT "exewithsource = TRUE" SYSTEM - CASE "-s:exewithsource=false" + CASE ":exewithsource=false" WriteConfigSetting "'[GENERAL SETTINGS]", "SaveExeWithSource", "FALSE" PRINT "exewithsource = FALSE" SYSTEM - CASE "-s:debuginfo" + CASE ":debuginfo" PRINT "debuginfo = "; IF idedebuginfo THEN PRINT "TRUE" ELSE PRINT "FALSE" SYSTEM - CASE "-s:debuginfo=true" + CASE ":debuginfo=true" PRINT "debuginfo = TRUE" WriteConfigSetting "'[GENERAL SETTINGS]", "DebugInfo", "TRUE 'INTERNAL VARIABLE USE ONLY!! DO NOT MANUALLY CHANGE!" idedebuginfo = 1 @@ -12737,7 +12736,7 @@ FOR i = 1 TO _COMMANDCOUNT CHDIR "../.." END IF SYSTEM - CASE "-s:debuginfo=false" + CASE ":debuginfo=false" PRINT "debuginfo = FALSE" WriteConfigSetting "'[GENERAL SETTINGS]", "DebugInfo", "FALSE 'INTERNAL VARIABLE USE ONLY!! DO NOT MANUALLY CHANGE!" idedebuginfo = 0 @@ -12766,27 +12765,24 @@ FOR i = 1 TO _COMMANDCOUNT PRINT " -s:exewithsource=true/false (Save .EXE in the source folder)" SYSTEM END SELECT - CASE "-q" 'Building a Qloud program - Cloud = 1 - ConsoleMode = 1 'Implies -x - NoIDEMode = 1 'Imples -c - CASE "-e" 'Option Explicit + CASE "-e", "/e" 'Option Explicit optionexplicit_cmd = -1 - CASE "-z" 'Not compiling C code + CASE "-z", "/z" 'Not compiling C code No_C_Compile_Mode = 1 ConsoleMode = 1 'Implies -x NoIDEMode = 1 'Implies -c - CASE "-x" 'Use the console + CASE "-x", "/x" 'Use the console ConsoleMode = 1 NoIDEMode = 1 'Implies -c - CASE "-c" 'Compile instead of edit + CASE "-c", "/c" 'Compile instead of edit NoIDEMode = 1 - CASE "-o" 'Specify an output file + CASE "-o", "/o" 'Specify an output file IF LEN(COMMAND$(i + 1)) > 0 THEN outputfile_cmd$ = COMMAND$(i + 1): i = i + 1 + CASE "-l", "/l" 'goto line (ide mode only); -l: + IF MID$(token$, 3, 1) = ":" THEN ideStartAtLine = VAL(MID$(token$, 4)) CASE ELSE 'Something we don't recognise, assume it's a filename - PassedFileName$ = token$ + IF PassedFileName$ = "" THEN PassedFileName$ = token$ END SELECT - NextCase: NEXT i IF LEN(PassedFileName$) THEN ParseCMDLineArgs$ = PassedFileName$