Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes and enhancements #530

Merged
merged 4 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/c/libqb/include/error_handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ extern uint32_t new_error;
extern uint32_t error_err;
extern uint32_t error_occurred;
extern uint32_t error_goto_line;
extern qbs *error_handler_history;
extern uint32_t error_handling;
extern uint32_t error_retry;

Expand Down
1 change: 1 addition & 0 deletions internal/c/libqb/src/error_handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ uint32_t error_occurred;
uint32_t error_retry;
uint32_t error_err; //=0;
uint32_t error_goto_line;
qbs *error_handler_history;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than a qbs could you use a std::stack<uint32_t>? It seems like that's what you're created and std::stack would avoid all the string manipulation.

uint32_t error_handling;

static double error_erl; //=0;
Expand Down
3 changes: 3 additions & 0 deletions internal/c/qbx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,9 @@ void sub_clear(int32 ignore, int32 ignore2, int32 stack, int32 passed) {
next_return_point = 0;
// reset error goto location to 'unhandled'
error_goto_line = 0;
uint32 qbs_tmp_base = qbs_tmp_list_nexti;
qbs_set(error_handler_history, qbs_new_txt_len("", 0));
qbs_cleanup(qbs_tmp_base, 0);
// invalidate RESUME
error_handling = 0;
return;
Expand Down
8 changes: 6 additions & 2 deletions source/ide/config/cfg_methods.bas
Original file line number Diff line number Diff line change
Expand Up @@ -495,11 +495,11 @@ SUB ReadInitialConfig

result = ReadConfigSetting(windowSettingsSection$, "IDE_Width", value$)
idewx = VAL(value$)
IF idewx < 80 OR idewx > 1000 THEN idewx = 120: WriteConfigSetting windowSettingsSection$, "IDE_Width", "120"
IF idewx < 80 OR idewx > 999 THEN idewx = 120: WriteConfigSetting windowSettingsSection$, "IDE_Width", "120"

result = ReadConfigSetting(windowSettingsSection$, "IDE_Height", value$)
idewy = VAL(value$)
IF idewy < 25 OR idewy > 1000 THEN idewy = 40: WriteConfigSetting windowSettingsSection$, "IDE_Height", "40"
IF idewy < 25 OR idewy > 999 THEN idewy = 40: WriteConfigSetting windowSettingsSection$, "IDE_Height", "40"

'--- Color settings (default = Super Dark Blue scheme, as of v1.5)
IDETextColor = _RGB32(216, 216, 216)
Expand Down Expand Up @@ -579,6 +579,10 @@ SUB ReadInitialConfig
StripDebugSymbols = ReadWriteBooleanSettingValue%(compilerSettingsSection$, "StripDebugSymbols", -1)

MaxParallelProcesses = ReadWriteLongSettingValue&(compilerSettingsSection$, "MaxParallelProcesses", 3)
IF MaxParallelProcesses < 1 OR MaxParallelProcesses > 128 THEN
MaxParallelProcesses = 3
WriteConfigSetting compilerSettingsSection$, "MaxParallelProcesses", "3"
END IF

ExtraCppFlags = ReadWriteStringSettingValue$(compilerSettingsSection$, "ExtraCppFlags", "")
ExtraLinkerFlags = ReadWriteStringSettingValue$(compilerSettingsSection$, "ExtraLinkerFlags", "")
Expand Down
15 changes: 12 additions & 3 deletions source/ide/ide_methods.bas
Original file line number Diff line number Diff line change
Expand Up @@ -2867,7 +2867,16 @@ FUNCTION ide2 (ignore)
IF x THEN
n$ = RTRIM$(LEFT$(a$, x - 1))
args$ = RIGHT$(a$, LEN(a$) - x + 1)
x = INSTR(args$, ")"): IF x THEN args$ = LEFT$(args$, x)
x2 = 0
FOR x = 1 TO LEN(args$)
IF MID$(args$, x, 1) = "(" AND x2 >= 0 THEN
x2 = x2 + 1
ELSEIF MID$(args$, x, 1) = ")" AND x2 > 0 THEN
x2 = x2 - 1
IF x2 = 0 THEN EXIT FOR
END IF
NEXT
args$ = LEFT$(args$, x)
ELSE
n$ = a$
args$ = ""
Expand Down Expand Up @@ -15652,7 +15661,7 @@ FUNCTION ideCompilerSettingsBox
'max. processes spinners
IF focus = mppSymUp AND info <> 0 THEN
a$ = str2$(VAL(idetxt(o(mppBox).txt)) + 1)
IF VAL(a$) > 8 THEN a$ = "8"
IF VAL(a$) > 128 THEN a$ = "128"
idetxt(o(mppBox).txt) = a$: o(mppBox).v1 = LEN(a$)
END IF
IF focus = mppSymDn AND info <> 0 THEN
Expand All @@ -15662,7 +15671,7 @@ FUNCTION ideCompilerSettingsBox
END IF
'max. processes text box (valid data check)
a$ = idetxt(o(mppBox).txt): o(mppBox).inv = 1
IF isuinteger(a$) _ANDALSO (VAL(a$) >= 1 AND VAL(a$) <= 8) THEN o(mppBox).inv = 0
IF isuinteger(a$) _ANDALSO (VAL(a$) >= 1 AND VAL(a$) <= 128) THEN o(mppBox).inv = 0
IF o(mppBox).inv THEN invdata = 1 'block confirmation, as long as invalid

'ok & cancel buttons
Expand Down
12 changes: 12 additions & 0 deletions source/qb64pe.bas
Original file line number Diff line number Diff line change
Expand Up @@ -2728,6 +2728,7 @@ DIM SHARED ErrTxtBuf: ErrTxtBuf = OpenBuffer%("O", tmpdir$ + "mainerr.txt")
'i. check the value of error_line
'ii. jump to the appropriate label
errorlabels = 0
WriteBufLine ErrTxtBuf, "if (!error_handler_history) error_handler_history = qbs_new(0, 0);"
WriteBufLine ErrTxtBuf, "if (error_occurred){ error_occurred=0;"

DIM SHARED ChainTxtBuf: ChainTxtBuf = OpenBuffer%("O", tmpdir$ + "chain.txt")
Expand Down Expand Up @@ -9104,9 +9105,18 @@ DO
lbl$ = getelement$(ca$, 4)
IF lbl$ = "0" THEN
WriteBufLine MainTxtBuf, "error_goto_line=0;"
WriteBufLine MainTxtBuf, "qbs_set(error_handler_history, qbs_new_txt_len(" + MKI$(&H2222) + ", 0));"
WriteBufLine MainTxtBuf, "qbs_cleanup(qbs_tmp_base, 0);"
l$ = l$ + sp + "0"
layoutdone = 1: IF LEN(layout$) THEN layout$ = layout$ + sp + l$ ELSE layout$ = l$
GOTO finishedline
ELSEIF UCASE$(lbl$) = "_LASTHANDLER" OR (UCASE$(lbl$) = "LASTHANDLER" AND qb64prefix_set = 1) THEN
WriteBufLine MainTxtBuf, "error_goto_line = qbr(func_val(error_handler_history));"
WriteBufLine MainTxtBuf, "qbs_set(error_handler_history, func_mid(error_handler_history, func_instr(NULL, error_handler_history, qbs_new_txt_len(" + CHR$(34) + "|" + CHR$(34) + ", 1), 0) + 1 , NULL, 0));"
WriteBufLine MainTxtBuf, "qbs_cleanup(qbs_tmp_base, 0);"
IF ASC(lbl$, 1) = 95 THEN l$ = l$ + sp + SCase$("_LastHandler") ELSE l$ = l$ + sp + SCase$("LastHandler")
layoutdone = 1: IF LEN(layout$) THEN layout$ = layout$ + sp + l$ ELSE layout$ = l$
GOTO finishedline
END IF
IF validlabel(lbl$) = 0 THEN a$ = "Invalid label": GOTO errmes

Expand Down Expand Up @@ -9142,6 +9152,8 @@ DO
l$ = l$ + sp + tlayout$
layoutdone = 1: IF LEN(layout$) THEN layout$ = layout$ + sp + l$ ELSE layout$ = l$
errorlabels = errorlabels + 1
WriteBufLine MainTxtBuf, "qbs_set(error_handler_history, qbs_add(qbs_add(qbs_str((int32)(error_goto_line)), qbs_new_txt_len(" + CHR$(34) + "|" + CHR$(34) + ", 1)), error_handler_history));"
WriteBufLine MainTxtBuf, "qbs_cleanup(qbs_tmp_base, 0);"
WriteBufLine MainTxtBuf, "error_goto_line=" + str2(errorlabels) + ";"
WriteBufLine ErrTxtBuf, "if (error_goto_line==" + str2(errorlabels) + "){error_handling=1; goto LABEL_" + lbl$ + ";}"
GOTO finishedline
Expand Down
2 changes: 1 addition & 1 deletion source/subs_functions/syntax_highlighter_list.bas
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ listOfKeywords$ = "@?@$CHECKING@$ERROR@$CONSOLE@ONLY@$DYNAMIC@$ELSE@$ELSEIF@$END
listOfKeywords$ = listOfKeywords$ + "_ERRORLINE@_ERRORMESSAGE$@_EXIT@_EXPLICIT@_EXPLICITARRAY@_FILEEXISTS@_FLOAT@_FONT@_FONTHEIGHT@_FONTWIDTH@_FREEFONT@_FREEIMAGE@_FREETIMER@_FULLSCREEN@_G2D@_G2R@_GLRENDER@_GREEN@_GREEN32@_HEIGHT@_HIDE@_HYPOT@_ICON@_INCLERRORFILE$@_INCLERRORLINE@_INTEGER64@_KEYCLEAR@_KEYDOWN@_KEYHIT@_LASTAXIS@_LASTBUTTON@_LASTWHEEL@_LIMIT@_LOADFONT@_LOADIMAGE@_MAPTRIANGLE@_MAPUNICODE@_MEM@_MEMCOPY@_MEMELEMENT@_MEMEXISTS@_MEMFILL@_MEMFREE@_MEMGET@_MEMIMAGE@_MEMSOUND@_MEMNEW@_MEMPUT@_MIDDLE@_MK$@_MOUSEBUTTON@_MOUSEHIDE@_MOUSEINPUT@_MOUSEMOVE@_MOUSEMOVEMENTX@_MOUSEMOVEMENTY@_MOUSEPIPEOPEN@_MOUSESHOW@_MOUSEWHEEL@_MOUSEX@_MOUSEY@_NEWIMAGE@_OFFSET@_OPENCLIENT@_OPENCONNECTION@_OPENHOST@_OS$@_PALETTECOLOR@_PI@_PIXELSIZE@_PRESERVE@_PRINTIMAGE@_PRINTMODE@_PRINTSTRING@_PRINTWIDTH@_PUTIMAGE@_R2D@_R2G@_RED@_RED32@_RESIZE@_RESIZEHEIGHT@_RESIZEWIDTH@_RGB@_RGB32@_RGBA@_RGBA32@_ROUND@_SCREENCLICK@_SCREENEXISTS@_SCREENHIDE@_SCREENICON@_SCREENIMAGE@_SCREENMOVE@_SCREENPRINT@_SCREENSHOW@_SCREENX@_SCREENY@_SEC@_SECH@_SETALPHA@_SHELLHIDE@_SINH@_SNDBAL@_SNDCLOSE@_SNDCOPY@_SNDGETPOS@_SNDLEN@_SNDLIMIT@_SNDLOOP@_SNDOPEN@_SNDOPENRAW@_SNDPAUSE@_SNDPAUSED@_SNDPLAY@_SNDPLAYCOPY@_SNDPLAYFILE@_SNDPLAYING@_SNDRATE@_SNDRAW@_SNDRAWDONE@_SNDRAWLEN@_SNDSETPOS@_SNDSTOP@_SNDVOL@_SOURCE@_STARTDIR$@_STRCMP@_STRICMP@_TANH@_TITLE@_TITLE$@_UNSIGNED@_WHEEL@_WIDTH@_WINDOWHANDLE@_WINDOWHASFOCUS@_GLACCUM@_GLALPHAFUNC@_GLARETEXTURESRESIDENT@_GLARRAYELEMENT@_GLBEGIN@_GLBINDTEXTURE@_GLBITMAP@_GLBLENDFUNC@_GLCALLLIST@_GLCALLLISTS@_GLCLEAR@_GLCLEARACCUM@_GLCLEARCOLOR@_GLCLEARDEPTH@_GLCLEARINDEX@_GLCLEARSTENCIL@_GLCLIPPLANE@_GLCOLOR3B@_GLCOLOR3BV@_GLCOLOR3D@_GLCOLOR3DV@_GLCOLOR3F@_GLCOLOR3FV@_GLCOLOR3I@_GLCOLOR3IV@_GLCOLOR3S@_GLCOLOR3SV@_GLCOLOR3UB@_GLCOLOR3UBV@_GLCOLOR3UI@_GLCOLOR3UIV@_GLCOLOR3US@_GLCOLOR3USV@_GLCOLOR4B@_GLCOLOR4BV@_GLCOLOR4D@_GLCOLOR4DV@_GLCOLOR4F@_GLCOLOR4FV@_GLCOLOR4I@_GLCOLOR4IV@_GLCOLOR4S@_GLCOLOR4SV@_GLCOLOR4UB@_GLCOLOR4UBV@_GLCOLOR4UI@_GLCOLOR4UIV@_GLCOLOR4US@_GLCOLOR4USV@_GLCOLORMASK@_GLCOLORMATERIAL@_GLCOLORPOINTER@_GLCOPYPIXELS@_GLCOPYTEXIMAGE1D@_GLCOPYTEXIMAGE2D@_GLCOPYTEXSUBIMAGE1D@"
listOfKeywords$ = listOfKeywords$ + "_GLCOPYTEXSUBIMAGE2D@_GLCULLFACE@_GLDELETELISTS@_GLDELETETEXTURES@_GLDEPTHFUNC@_GLDEPTHMASK@_GLDEPTHRANGE@_GLDISABLE@_GLDISABLECLIENTSTATE@_GLDRAWARRAYS@_GLDRAWBUFFER@_GLDRAWELEMENTS@_GLDRAWPIXELS@_GLEDGEFLAG@_GLEDGEFLAGPOINTER@_GLEDGEFLAGV@_GLENABLE@_GLENABLECLIENTSTATE@_GLEND@_GLENDLIST@_GLEVALCOORD1D@_GLEVALCOORD1DV@_GLEVALCOORD1F@_GLEVALCOORD1FV@_GLEVALCOORD2D@_GLEVALCOORD2DV@_GLEVALCOORD2F@_GLEVALCOORD2FV@_GLEVALMESH1@_GLEVALMESH2@_GLEVALPOINT1@_GLEVALPOINT2@_GLFEEDBACKBUFFER@_GLFINISH@_GLFLUSH@_GLFOGF@_GLFOGFV@_GLFOGI@_GLFOGIV@_GLFRONTFACE@_GLFRUSTUM@_GLGENLISTS@_GLGENTEXTURES@_GLGETBOOLEANV@_GLGETCLIPPLANE@_GLGETDOUBLEV@_GLGETERROR@_GLGETFLOATV@_GLGETINTEGERV@_GLGETLIGHTFV@_GLGETLIGHTIV@_GLGETMAPDV@_GLGETMAPFV@_GLGETMAPIV@_GLGETMATERIALFV@_GLGETMATERIALIV@_GLGETPIXELMAPFV@_GLGETPIXELMAPUIV@_GLGETPIXELMAPUSV@_GLGETPOINTERV@_GLGETPOLYGONSTIPPLE@_GLGETSTRING@_GLGETTEXENVFV@_GLGETTEXENVIV@_GLGETTEXGENDV@_GLGETTEXGENFV@_GLGETTEXGENIV@_GLGETTEXIMAGE@_GLGETTEXLEVELPARAMETERFV@_GLGETTEXLEVELPARAMETERIV@_GLGETTEXPARAMETERFV@_GLGETTEXPARAMETERIV@_GLHINT@_GLINDEXMASK@_GLINDEXPOINTER@_GLINDEXD@_GLINDEXDV@_GLINDEXF@_GLINDEXFV@_GLINDEXI@_GLINDEXIV@_GLINDEXS@_GLINDEXSV@_GLINDEXUB@_GLINDEXUBV@_GLINITNAMES@_GLINTERLEAVEDARRAYS@_GLISENABLED@_GLISLIST@_GLISTEXTURE@_GLLIGHTMODELF@_GLLIGHTMODELFV@_GLLIGHTMODELI@_GLLIGHTMODELIV@_GLLIGHTF@_GLLIGHTFV@_GLLIGHTI@_GLLIGHTIV@_GLLINESTIPPLE@_GLLINEWIDTH@_GLLISTBASE@_GLLOADIDENTITY@_GLLOADMATRIXD@_GLLOADMATRIXF@_GLLOADNAME@_GLLOGICOP@_GLMAP1D@_GLMAP1F@_GLMAP2D@_GLMAP2F@_GLMAPGRID1D@_GLMAPGRID1F@_GLMAPGRID2D@_GLMAPGRID2F@_GLMATERIALF@_GLMATERIALFV@_GLMATERIALI@_GLMATERIALIV@_GLMATRIXMODE@_GLMULTMATRIXD@_GLMULTMATRIXF@_GLNEWLIST@_GLNORMAL3B@_GLNORMAL3BV@_GLNORMAL3D@_GLNORMAL3DV@_GLNORMAL3F@_GLNORMAL3FV@_GLNORMAL3I@_GLNORMAL3IV@_GLNORMAL3S@_GLNORMAL3SV@_GLNORMALPOINTER@_GLORTHO@_GLPASSTHROUGH@_GLPIXELMAPFV@_GLPIXELMAPUIV@_GLPIXELMAPUSV@_GLPIXELSTOREF@_GLPIXELSTOREI@_GLPIXELTRANSFERF@_GLPIXELTRANSFERI@_GLPIXELZOOM@_GLPOINTSIZE@_GLPOLYGONMODE@_GLPOLYGONOFFSET@_GLPOLYGONSTIPPLE@"
listOfKeywords$ = listOfKeywords$ + "_GLPOPATTRIB@_GLPOPCLIENTATTRIB@_GLPOPMATRIX@_GLPOPNAME@_GLPRIORITIZETEXTURES@_GLPUSHATTRIB@_GLPUSHCLIENTATTRIB@_GLPUSHMATRIX@_GLPUSHNAME@_GLRASTERPOS2D@_GLRASTERPOS2DV@_GLRASTERPOS2F@_GLRASTERPOS2FV@_GLRASTERPOS2I@_GLRASTERPOS2IV@_GLRASTERPOS2S@_GLRASTERPOS2SV@_GLRASTERPOS3D@_GLRASTERPOS3DV@_GLRASTERPOS3F@_GLRASTERPOS3FV@_GLRASTERPOS3I@_GLRASTERPOS3IV@_GLRASTERPOS3S@_GLRASTERPOS3SV@_GLRASTERPOS4D@_GLRASTERPOS4DV@_GLRASTERPOS4F@_GLRASTERPOS4FV@_GLRASTERPOS4I@_GLRASTERPOS4IV@_GLRASTERPOS4S@_GLRASTERPOS4SV@_GLREADBUFFER@_GLREADPIXELS@_GLRECTD@_GLRECTDV@_GLRECTF@_GLRECTFV@_GLRECTI@_GLRECTIV@_GLRECTS@_GLRECTSV@_GLRENDERMODE@_GLROTATED@_GLROTATEF@_GLSCALED@_GLSCALEF@_GLSCISSOR@_GLSELECTBUFFER@_GLSHADEMODEL@_GLSTENCILFUNC@_GLSTENCILMASK@_GLSTENCILOP@_GLTEXCOORD1D@_GLTEXCOORD1DV@_GLTEXCOORD1F@_GLTEXCOORD1FV@_GLTEXCOORD1I@_GLTEXCOORD1IV@_GLTEXCOORD1S@_GLTEXCOORD1SV@_GLTEXCOORD2D@_GLTEXCOORD2DV@_GLTEXCOORD2F@_GLTEXCOORD2FV@_GLTEXCOORD2I@_GLTEXCOORD2IV@_GLTEXCOORD2S@_GLTEXCOORD2SV@_GLTEXCOORD3D@_GLTEXCOORD3DV@_GLTEXCOORD3F@_GLTEXCOORD3FV@_GLTEXCOORD3I@_GLTEXCOORD3IV@_GLTEXCOORD3S@_GLTEXCOORD3SV@_GLTEXCOORD4D@_GLTEXCOORD4DV@_GLTEXCOORD4F@_GLTEXCOORD4FV@_GLTEXCOORD4I@_GLTEXCOORD4IV@_GLTEXCOORD4S@_GLTEXCOORD4SV@_GLTEXCOORDPOINTER@_GLTEXENVF@_GLTEXENVFV@_GLTEXENVI@_GLTEXENVIV@_GLTEXGEND@_GLTEXGENDV@_GLTEXGENF@_GLTEXGENFV@_GLTEXGENI@_GLTEXGENIV@_GLTEXIMAGE1D@_GLTEXIMAGE2D@_GLTEXPARAMETERF@_GLTEXPARAMETERFV@_GLTEXPARAMETERI@_GLTEXPARAMETERIV@_GLTEXSUBIMAGE1D@_GLTEXSUBIMAGE2D@_GLTRANSLATED@_GLTRANSLATEF@_GLVERTEX2D@_GLVERTEX2DV@_GLVERTEX2F@_GLVERTEX2FV@_GLVERTEX2I@_GLVERTEX2IV@_GLVERTEX2S@_GLVERTEX2SV@_GLVERTEX3D@_GLVERTEX3DV@_GLVERTEX3F@_GLVERTEX3FV@_GLVERTEX3I@_GLVERTEX3IV@_GLVERTEX3S@_GLVERTEX3SV@_GLVERTEX4D@_GLVERTEX4DV@_GLVERTEX4F@_GLVERTEX4FV@_GLVERTEX4I@_GLVERTEX4IV@_GLVERTEX4S@_GLVERTEX4SV@_GLVERTEXPOINTER@_GLVIEWPORT@SMOOTH@STRETCH@_ANTICLOCKWISE@_BEHIND@_CLEAR@_FILLBACKGROUND@_GLUPERSPECTIVE@_HARDWARE@_HARDWARE1@_KEEPBACKGROUND@_NONE@_OFF@_ONLY@_ONLYBACKGROUND@_ONTOP@_SEAMLESS@_SMOOTH@_SMOOTHSHRUNK@_SMOOTHSTRETCHED@"
listOfKeywords$ = listOfKeywords$ + "_SOFTWARE@_SQUAREPIXELS@_STRETCH@_ALLOWFULLSCREEN@_ALL@_ECHO@_READFILE$@_WRITEFILE@_INSTRREV@_TRIM$@_ACCEPTFILEDROP@_FINISHDROP@_TOTALDROPPEDFILES@_DROPPEDFILE@_DROPPEDFILE$@_SHR@_SHL@_ROR@_ROL@"
listOfKeywords$ = listOfKeywords$ + "_SOFTWARE@_SQUAREPIXELS@_STRETCH@_ALLOWFULLSCREEN@_ALL@_ECHO@_READFILE$@_WRITEFILE@_INSTRREV@_LASTHANDLER@_TRIM$@_ACCEPTFILEDROP@_FINISHDROP@_TOTALDROPPEDFILES@_DROPPEDFILE@_DROPPEDFILE$@_SHR@_SHL@_ROR@_ROL@"
listOfKeywords$ = listOfKeywords$ + "_ADLER32@_CRC32@_MD5$@_DEFLATE$@_INFLATE$@_READBIT@_RESETBIT@_SETBIT@_TOGGLEBIT@$INCLUDEONCE@$ASSERTS@CONSOLE@_ASSERT@_CAPSLOCK@_NUMLOCK@_SCROLLLOCK@_TOGGLE@_CONSOLEFONT@_CONSOLECURSOR@_CONSOLEINPUT@_CINP@$NOPREFIX@$COLOR@$DEBUG@$EMBED@_EMBEDDED$@_ENVIRONCOUNT@$UNSTABLE@$MIDISOUNDFONT@"
listOfKeywords$ = listOfKeywords$ + "_NOTIFYPOPUP@_MESSAGEBOX@_INPUTBOX$@_SELECTFOLDERDIALOG$@_COLORCHOOSERDIALOG@_OPENFILEDIALOG$@_SAVEFILEDIALOG$@_SAVEIMAGE@_FILES$@_FULLPATH$@_NEGATE@_ANDALSO@_ORELSE@"
listOfKeywords$ = listOfKeywords$ + "_STATUSCODE@_SNDNEW@_SCALEDWIDTH@_SCALEDHEIGHT@_UFONTHEIGHT@_UPRINTWIDTH@_ULINESPACING@_UPRINTSTRING@_UCHARPOS@_MIDISOUNDBANK@"
65 changes: 65 additions & 0 deletions tests/compile_tests/on_error/errtest.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
$CONSOLE:ONLY

'interfacing internal variables
DECLARE LIBRARY "errtest"
FUNCTION GetErrorHistory$
FUNCTION GetErrorGotoLine&
END DECLARE

'testing handler behavior
Status
ON ERROR GOTO mainHandler
Status
ERROR 5
NormalTest
ERROR 5
RecursiveTest 3
ERROR 5
ON ERROR GOTO _LASTHANDLER
Status

'return to test script
SYSTEM

'-----------------------------------------------------------------------
mainHandler:
PRINT " CALLED: main handler"
RESUME NEXT
'-----
nSubHandler:
PRINT " CALLED: normal sub handler"
RESUME NEXT
'-----
rSubHandler:
PRINT " CALLED: recursive sub handler"
RESUME NEXT

'-----------------------------------------------------------------------
SUB NormalTest
ON ERROR GOTO nSubHandler
Status
ERROR 5
ON ERROR GOTO _LASTHANDLER
Status
END SUB
'-----
SUB RecursiveTest (n%)
ON ERROR GOTO rSubHandler
Status
ERROR 5
IF n% > 1 THEN RecursiveTest n% - 1
ON ERROR GOTO _LASTHANDLER
Status
END SUB

'-----------------------------------------------------------------------
SUB Status
PRINT: PRINT "HISTORY: "; "<"; GetErrorHistory$; ">"
SELECT CASE GetErrorGotoLine&
CASE 0: PRINT " ACTIVE: unhandled"
CASE 1: PRINT " ACTIVE: main handler"
CASE 2: PRINT " ACTIVE: normal sub handler"
CASE 3: PRINT " ACTIVE: recursive sub handler"
END SELECT
END SUB

12 changes: 12 additions & 0 deletions tests/compile_tests/on_error/errtest.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
unsigned char cont[256];

unsigned char *GetErrorHistory() {
memset(cont, 0, 256);
memcpy (cont, error_handler_history -> chr, error_handler_history -> len);
return cont;
}

uint32_t GetErrorGotoLine() {
return error_goto_line;
}

40 changes: 40 additions & 0 deletions tests/compile_tests/on_error/errtest.output
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

HISTORY: <>
ACTIVE: unhandled

HISTORY: < 0|>
ACTIVE: main handler
CALLED: main handler

HISTORY: < 1| 0|>
ACTIVE: normal sub handler
CALLED: normal sub handler

HISTORY: < 0|>
ACTIVE: main handler
CALLED: main handler

HISTORY: < 1| 0|>
ACTIVE: recursive sub handler
CALLED: recursive sub handler

HISTORY: < 3| 1| 0|>
ACTIVE: recursive sub handler
CALLED: recursive sub handler

HISTORY: < 3| 3| 1| 0|>
ACTIVE: recursive sub handler
CALLED: recursive sub handler

HISTORY: < 3| 1| 0|>
ACTIVE: recursive sub handler

HISTORY: < 1| 0|>
ACTIVE: recursive sub handler

HISTORY: < 0|>
ACTIVE: main handler
CALLED: main handler

HISTORY: <>
ACTIVE: unhandled