From: <and...@us...> - 2023-05-21 17:24:58
|
Revision: 7390 http://sourceforge.net/p/nsis/code/7390 Author: anders_k Date: 2023-05-21 17:24:55 +0000 (Sun, 21 May 2023) Log Message: ----------- Added internal pragma to dump compiler state Modified Paths: -------------- NSIS/trunk/Source/build.cpp NSIS/trunk/Source/build.h NSIS/trunk/Source/scriptpp.cpp Modified: NSIS/trunk/Source/build.cpp =================================================================== --- NSIS/trunk/Source/build.cpp 2023-05-21 16:27:44 UTC (rev 7389) +++ NSIS/trunk/Source/build.cpp 2023-05-21 17:24:55 UTC (rev 7390) @@ -3462,6 +3462,24 @@ int succ, num = line.gettoken_intx(4, &succ);SCRIPT_MSG(_T("%#x %d\n"),num,succ); return ((succ ? definedlist.set_si32(name, num) : definedlist.set(name, _T(""))), rvSucc); } + if (line.gettoken_enum(2, _T("dump\0")) == 0) + { + if (line.gettoken_enum(3, _T("defines\0")) == 0) + { + for (UINT i = 0, c = definedlist.getnum(); i < c; ++i) + SCRIPT_MSG(_T("%") NPRIs _T("=%") NPRIs _T("\n"), definedlist.getname(i), definedlist.getvalue(i)); + } + else if (line.gettoken_enum(3, _T("macros\0")) == 0) + { + const TCHAR *mnam; + for (size_t i = 0; (mnam = GetMacro(i)) != 0; ++i) + SCRIPT_MSG(_T("%") NPRIs _T("\n"), mnam); + } + else + { + SCRIPT_MSG(_T("V=%d\n"), get_verbosity()); + } + } return rvErr; } Modified: NSIS/trunk/Source/build.h =================================================================== --- NSIS/trunk/Source/build.h 2023-05-21 16:27:44 UTC (rev 7389) +++ NSIS/trunk/Source/build.h 2023-05-21 17:24:55 UTC (rev 7390) @@ -332,6 +332,7 @@ int parseScript(); int includeScript(const TCHAR *f, NStreamEncoding&enc); TCHAR* GetMacro(const TCHAR *macroname, TCHAR**macroend = 0); + TCHAR* GetMacro(size_t idx); bool MacroExists(const TCHAR *macroname) { return !!GetMacro(macroname); } LANGID ParseLangIdParameter(const LineParser&line, int token); int LoadLicenseFile(const TCHAR *file, TCHAR** pdata, const TCHAR *cmdname, WORD AnsiCP); Modified: NSIS/trunk/Source/scriptpp.cpp =================================================================== --- NSIS/trunk/Source/scriptpp.cpp 2023-05-21 16:27:44 UTC (rev 7389) +++ NSIS/trunk/Source/scriptpp.cpp 2023-05-21 17:24:55 UTC (rev 7390) @@ -259,6 +259,21 @@ return 0; } +TCHAR* CEXEBuild::GetMacro(size_t idx) +{ + TCHAR *t = (TCHAR*)m_macros.get(), *mbeg, *mbufbeg = t; + for (size_t i = 0, cbAll = m_macros.getlen(); t && *t; ++t) + { + if ((size_t)t - (size_t)mbufbeg >= cbAll) break; + if (i++ == idx) return t; + t += _tcslen(t) + 1; // advance over macro name + while (*t) t += _tcslen(t) + 1; // advance over parameters + t++; // Separator between parameters and data + while (*t) t += _tcslen(t) + 1; // advance over data + } + return 0; +} + int CEXEBuild::pp_macro(LineParser&line) { const TCHAR*const macroname = line.gettoken_str(1), *tokstr; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |