MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / ScriptWarning

Method ScriptWarning

source/script.cpp:13314–13349  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13312
13313
13314void Script::ScriptWarning(WarnMode warnMode, LPCTSTR aWarningText, LPCTSTR aExtraInfo, Line *line)
13315{
13316 if (warnMode == WARNMODE_OFF)
13317 return;
13318
13319 if (!line) line = mCurrLine;
13320 int fileIndex = line ? line->mFileIndex : mCurrFileIndex;
13321 FileIndexType lineNumber = line ? line->mLineNumber : mCombinedLineNumber;
13322
13323 TCHAR buf[MSGBOX_TEXT_SIZE], *cp = buf;
13324 int buf_space_remaining = (int)_countof(buf);
13325
13326 #define STD_WARNING_FORMAT _T("%s (%d) : ==> Warning: %s\n")
13327 cp += sntprintf(cp, buf_space_remaining, STD_WARNING_FORMAT, Line::sSourceFile[fileIndex], lineNumber, aWarningText);
13328 buf_space_remaining = (int)(_countof(buf) - (cp - buf));
13329
13330 if (*aExtraInfo)
13331 {
13332 cp += sntprintf(cp, buf_space_remaining, _T(" Specifically: %s\n"), aExtraInfo);
13333 buf_space_remaining = (int)(_countof(buf) - (cp - buf));
13334 }
13335
13336 if (warnMode == WARNMODE_STDOUT)
13337 PrintErrorStdOut(buf);
13338 else
13339#ifdef CONFIG_DEBUGGER
13340 if (!g_Debugger.OutputStdErr(buf))
13341#endif
13342 OutputDebugString(buf);
13343
13344 // In MsgBox mode, MsgBox is in addition to OutputDebug
13345 if (warnMode == WARNMODE_MSGBOX)
13346 {
13347 g_script.RuntimeError(aWarningText, aExtraInfo, WARN, line);
13348 }
13349}
13350
13351
13352

Callers

nothing calls this directly

Calls 3

sntprintfFunction · 0.85
OutputStdErrMethod · 0.80
RuntimeErrorMethod · 0.80

Tested by

no test coverage detected