diff --git a/uppsrc/CodeEditor/LogSyntax.cpp b/uppsrc/CodeEditor/LogSyntax.cpp index 83ed0f126..674d74ed2 100644 --- a/uppsrc/CodeEditor/LogSyntax.cpp +++ b/uppsrc/CodeEditor/LogSyntax.cpp @@ -54,7 +54,7 @@ void LogSyntax::Highlight(const wchar *s, const wchar *end, HighlightOutput& hls } else { bool hl = findarg(c, '[', ']', '(', ')', ':', '-', '=', '{', '}', '/', '<', '>', '*', - '#', '@', '\\', '.') >= 0 + '#', '@', '\\', '.') >= 0; hls.Put(1, hl ? hl_style[INK_OPERATOR] : ink); s++; } diff --git a/uppsrc/Core/Stream.cpp b/uppsrc/Core/Stream.cpp index f46d4062e..a0d7122cd 100644 --- a/uppsrc/Core/Stream.cpp +++ b/uppsrc/Core/Stream.cpp @@ -737,9 +737,6 @@ Stream& Stream::operator%(String& s) { Get(); // reserved for future use... or removal } } - DDUMP(len); - DDUMP(GetPos()); - DDUMP(GetSize()); if(IsError() || len + GetPos() > GetSize()) LoadError(); else { diff --git a/uppsrc/ide/Builders/Build.cpp b/uppsrc/ide/Builders/Build.cpp index 92eef6ec0..c25c0bdb3 100644 --- a/uppsrc/ide/Builders/Build.cpp +++ b/uppsrc/ide/Builders/Build.cpp @@ -155,6 +155,7 @@ One MakeBuild::CreateBuilder(Host *host) b->release_link = bm.Get("RELEASE_LINK", ""); b->script = bm.Get("SCRIPT", ""); b->main_conf = !!main_conf.GetCount(); + b->allow_pch = bm.Get("ALLOW_PRECOMPILED_HEADERS", "") == "1"; return b; } @@ -221,6 +222,7 @@ struct OneFileHost : Host { virtual bool Run(const char *cmdline, int slot, String key, int blitz_count) { return host->Run(cmdline, slot, key, blitz_count); } virtual bool Run(const char *cmdline, Stream& out, int slot, String key, int blitz_count) { return host->Run(cmdline, out, slot, key, blitz_count); } virtual bool Wait() { return host->Wait(); } + virtual bool Wait(int slot) { return host->Wait(slot); } virtual One StartProcess(const char *c) { return host->StartProcess(c); } virtual void Launch(const char *cmdline, bool) { host->Launch(cmdline); } virtual void AddFlags(Index& cfg) { host->AddFlags(cfg); } diff --git a/uppsrc/ide/Builders/Builders.h b/uppsrc/ide/Builders/Builders.h index de6bdfbbf..ee9acd9d4 100644 --- a/uppsrc/ide/Builders/Builders.h +++ b/uppsrc/ide/Builders/Builders.h @@ -46,6 +46,7 @@ struct CppBuilder : Builder { bool Run(const char *cmdline, int slot, String key, int blitz_count); bool Run(const char *cmdline, Stream& out, int slot, String key, int blitz_count); bool Wait(); + bool Wait(int slot); bool HasFlag(const char *f) const { return config.Find(f) >= 0; } bool Cp(const String& cmd, const String& package, bool& error); bool Cd(const String& cmd); diff --git a/uppsrc/ide/Builders/CppBuilder.cpp b/uppsrc/ide/Builders/CppBuilder.cpp index e1aab53a3..d81f71b11 100644 --- a/uppsrc/ide/Builders/CppBuilder.cpp +++ b/uppsrc/ide/Builders/CppBuilder.cpp @@ -183,6 +183,11 @@ bool CppBuilder::Wait() return host->Wait(); } +bool CppBuilder::Wait(int slot) +{ + return host->Wait(slot); +} + void CppBuilder::ChDir(const String& path) { host->ChDir(path); diff --git a/uppsrc/ide/Builders/MscBuilder.icpp b/uppsrc/ide/Builders/MscBuilder.icpp index bc2b36f62..34dd8aac4 100644 --- a/uppsrc/ide/Builders/MscBuilder.icpp +++ b/uppsrc/ide/Builders/MscBuilder.icpp @@ -237,6 +237,38 @@ bool MscBuilder::BuildPackage(const String& package, Vector& linkfile, S Vector sobjfile; bool error = false; + String pch; + + if(allow_pch && pkg.GetCount() && IsMsc86()) { + String hdr_path = SourcePath(package, pkg[0]); + if(IsCHeaderFile(hdr_path) && HdependBlitzApproved(hdr_path)) { + // add check: .c in package should prohibit precompiled header + // add check: Only simple file name + // add check: Some file in package #includes it + int time = GetTickCount(); + int slot = AllocSlot(); + String pchfile = CatAnyPath(outdir, GetFileTitle(hdr_path) + ".pch"); + String cppfile = ForceExt(hdr_path, ".$pch$.cpp"); + SaveFile(cppfile, "#include \"" + pkg[0] + "\"\r\n"); + if(slot < 0 || + !Run(Join(cc, cpp_options) + PdbPch(package, slot, false) + + " -Tp " + GetHostPathQ(hdr_path) + " -Fp" + GetHostPathQ(cppfile) + + " -Yc" + pkg[0], + slot, GetHostPath(pchfile), 1)) + error = true; + if(!Wait(slot)) + error = true; + PutVerbose("precompiled header " + pchfile + " compiled in " + GetPrintTime(time)); + if(error) { + IdeConsoleEndGroup(); + return false; + } + DeleteFile(pchfile); + pch << " -Yu" << GetHostPathQ(GetFileTitle(hdr_path)) + << " -Fp" << GetHostPathQ(pchfile); + } + } + for(i = 0; i < pkg.GetCount(); i++) { if(!IdeIsBuilding()) return false; @@ -274,8 +306,10 @@ bool MscBuilder::BuildPackage(const String& package, Vector& linkfile, S if(b.build) { PutConsole("BLITZ:" + b.info); int slot = AllocSlot(); - if(slot < 0 || ! Run(Join(cc, cpp_options) + PdbPch(package, slot, false) - + " -Tp " + GetHostPathQ(b.path) + " -Fo" + GetHostPathQ(b.object), slot, GetHostPath(b.object), b.count)) + if(slot < 0 || + !Run(Join(cc, cpp_options) + PdbPch(package, slot, false) + + " -Tp " + GetHostPathQ(b.path) + " -Fo" + GetHostPathQ(b.object), + slot, GetHostPath(b.object), b.count)) error = true; } } @@ -340,7 +374,7 @@ bool MscBuilder::BuildPackage(const String& package, Vector& linkfile, S int slot = AllocSlot(); if(slot < 0 || !Run(c + PdbPch(package, slot, !sContainsPchOptions(cc) && !sContainsPchOptions(soptions[i])) + " " + soptions[i] + (ext == ".c" ? Join(" -Tc", c_options) : Join(" -Tp", cpp_options)) + ' ' - + GetHostPathQ(fn) + " -Fo" + GetHostPathQ(objfile), slot, GetHostPath(objfile), 1)) + + GetHostPathQ(fn) + " -Fo" + GetHostPathQ(objfile) + pch, slot, GetHostPath(objfile), 1)) execerr = true; } if(execerr) diff --git a/uppsrc/ide/Core/Core.cpp b/uppsrc/ide/Core/Core.cpp index a84e56e68..5540c31c8 100644 --- a/uppsrc/ide/Core/Core.cpp +++ b/uppsrc/ide/Core/Core.cpp @@ -188,6 +188,11 @@ bool IdeConsoleWait() return the_ide && the_ide->IdeConsoleWait(); } +bool IdeConsoleWait(int slot) +{ + return the_ide && the_ide->IdeConsoleWait(slot); +} + void IdeGotoCodeRef(String s) { if(the_ide) the_ide->IdeGotoCodeRef(s); diff --git a/uppsrc/ide/Core/Core.h b/uppsrc/ide/Core/Core.h index 44da24a74..4ae839ffa 100644 --- a/uppsrc/ide/Core/Core.h +++ b/uppsrc/ide/Core/Core.h @@ -55,6 +55,7 @@ public: virtual void IdeConsoleBeginGroup(String group) = 0; virtual void IdeConsoleEndGroup() = 0; virtual bool IdeConsoleWait() = 0; + virtual bool IdeConsoleWait(int slot) = 0; virtual bool IdeIsDebug() const = 0; virtual void IdeEndDebug() = 0; @@ -109,6 +110,7 @@ void IdeConsoleFlush(); void IdeConsoleBeginGroup(String group); void IdeConsoleEndGroup(); bool IdeConsoleWait(); +bool IdeConsoleWait(int slot); void IdeGotoCodeRef(String s); String GetDefaultMethod(); @@ -391,6 +393,7 @@ struct Builder { String mainpackage; bool doall; bool main_conf; + bool allow_pch; virtual bool BuildPackage(const String& package, Vector& linkfile, String& linkoptions, const Vector& all_uses, const Vector& all_libraries, int optimize) diff --git a/uppsrc/ide/Core/Hdepend.cpp b/uppsrc/ide/Core/Hdepend.cpp index fdd2d126b..ef12c30b3 100644 --- a/uppsrc/ide/Core/Hdepend.cpp +++ b/uppsrc/ide/Core/Hdepend.cpp @@ -415,8 +415,6 @@ bool Hdepend::BlitzApproved(const String& path) return false; if(info.guarded) return true; - if(info.guarded) - return true; for(int i = 0; i < info.depend.GetCount(); i++) if(!info.bydefine[i] && !map[info.depend[i]].CanBlitz()) { PutVerbose(String().Cat() << map.GetKey(info.depend[i]) diff --git a/uppsrc/ide/Core/Host.cpp b/uppsrc/ide/Core/Host.cpp index fc0d7a373..e9b137889 100644 --- a/uppsrc/ide/Core/Host.cpp +++ b/uppsrc/ide/Core/Host.cpp @@ -141,6 +141,11 @@ bool LocalHost::Wait() return IdeConsoleWait(); } +bool LocalHost::Wait(int slot) +{ + return IdeConsoleWait(slot); +} + One LocalHost::StartProcess(const char *cmdline) { try { diff --git a/uppsrc/ide/Core/Host.h b/uppsrc/ide/Core/Host.h index 425b74d64..4a685c3ae 100644 --- a/uppsrc/ide/Core/Host.h +++ b/uppsrc/ide/Core/Host.h @@ -24,6 +24,7 @@ struct Host { virtual bool Run(const char *cmdline, int slot, String key, int blitz_count) = 0; virtual bool Run(const char *cmdline, Stream& out, int slot, String key, int blitz_count) = 0; virtual bool Wait() = 0; + virtual bool Wait(int slot) = 0; virtual One StartProcess(const char *cmdline) = 0; virtual void Launch(const char *cmdline, bool console = false) = 0; virtual void AddFlags(Index& cfg) = 0; @@ -56,6 +57,7 @@ struct LocalHost : Host { virtual bool Run(const char *cmdline, int slot, String key, int blitz_count); virtual bool Run(const char *cmdline, Stream& out, int slot, String key, int blitz_count); virtual bool Wait(); + virtual bool Wait(int slot); virtual One StartProcess(const char *cmdline); virtual void Launch(const char *cmdline, bool console); virtual void AddFlags(Index& cfg); diff --git a/uppsrc/ide/Methods.cpp b/uppsrc/ide/Methods.cpp index 1bc2e0797..f36d2731f 100644 --- a/uppsrc/ide/Methods.cpp +++ b/uppsrc/ide/Methods.cpp @@ -145,6 +145,7 @@ struct BuildMethods : public WithBuildMethodsLayout TextOption release_blitz; TextSwitch release_linkmode; TextOption linkmode_lock; + TextOption allow_pch; DirTable path; DirTable include; DirTable lib; @@ -219,6 +220,10 @@ BuildMethods::BuildMethods() #endif method.AddCtrl("SCRIPT", scriptfile); method.AddCtrl("LINKMODE_LOCK", linkmode_lock); + + allow_pch.SetLabel("Allow precompiled headers"); + method.AddCtrl("ALLOW_PRECOMPILED_HEADERS", allow_pch); + open_script.Attach(scriptfile); open_script.Type("Build scripts (*.bsc)", "*.bsc") .AllFilesType(); diff --git a/uppsrc/ide/ide.h b/uppsrc/ide/ide.h index 06fae9d53..36473f8e0 100644 --- a/uppsrc/ide/ide.h +++ b/uppsrc/ide/ide.h @@ -572,6 +572,7 @@ public: virtual void IdeConsoleBeginGroup(String group); virtual void IdeConsoleEndGroup(); virtual bool IdeConsoleWait(); + virtual bool IdeConsoleWait(int slot); virtual bool IdeIsDebug() const; virtual void IdeEndDebug(); diff --git a/uppsrc/ide/ide.lay b/uppsrc/ide/ide.lay index c86a5f29c..2f03f2bd2 100644 --- a/uppsrc/ide/ide.lay +++ b/uppsrc/ide/ide.lay @@ -181,36 +181,36 @@ LAYOUT(BuildMethodsLayout, 788, 560) ITEM(EditString, compiler, RightPosZ(264, 116).TopPosZ(4, 19)) ITEM(Label, dv___5, SetLabel(t_("&External debugger:")).RightPosZ(152, 100).TopPosZ(4, 19)) ITEM(EditString, debugger, RightPosZ(8, 140).TopPosZ(4, 20)) - ITEM(Label, dv___7, SetLabel(t_("Common options")).LeftPosZ(160, 108).TopPosZ(36, 19)) - ITEM(EditString, common_options, HSizePosZ(276, 8).TopPosZ(36, 19)) - ITEM(Label, dv___9, SetLabel(t_("Common C++ options")).LeftPosZ(160, 116).TopPosZ(56, 19)) - ITEM(EditString, common_cpp_options, HSizePosZ(276, 8).TopPosZ(56, 19)) - ITEM(Label, dv___11, SetLabel(t_("Common C options")).LeftPosZ(160, 108).TopPosZ(76, 19)) - ITEM(EditString, common_c_options, HSizePosZ(276, 8).TopPosZ(76, 19)) - ITEM(Label, dv___13, SetLabel(t_("Common fixed flags")).LeftPosZ(160, 108).TopPosZ(96, 19)) - ITEM(EditString, common_flags, HSizePosZ(276, 8).TopPosZ(96, 19)) - ITEM(LabelBox, dv___15, SetLabel(t_("Debug mode defaults")).HSizePosZ(160, 8).TopPosZ(124, 44)) - ITEM(Label, dv___16, SetLabel(t_("Default debug info level:")).LeftPosZ(168, 132).TopPosZ(140, 19)) - ITEM(DropList, debug_info, HSizePosZ(304, 368).TopPosZ(140, 19)) - UNTYPED(debug_blitz, SwitchImage(false).SetLabel(t_("Use BLIT&Z")).HSizePosZ(428, 272).TopPosZ(140, 15)) - UNTYPED(debug_linkmode, SetLabel(t_("All static\nShared libs\nAll shared")).HSizePosZ(540, -4).TopPosZ(140, 15)) - ITEM(Label, dv___20, SetLabel(t_("&Debug options:")).LeftPosZ(160, 100).TopPosZ(172, 19)) - ITEM(EditString, debug_options, HSizePosZ(276, 8).TopPosZ(172, 19)) - ITEM(Label, dv___22, SetLabel(t_("Debug fixed flags:")).LeftPosZ(160, 100).TopPosZ(192, 19)) - ITEM(EditString, debug_flags, HSizePosZ(276, 8).TopPosZ(192, 19)) - ITEM(Label, dv___24, SetLabel(t_("Debug link options:")).LeftPosZ(160, 100).TopPosZ(212, 19)) - ITEM(EditString, debug_link, HSizePosZ(276, 8).TopPosZ(212, 19)) - UNTYPED(release_linkmode, SetLabel(t_("All static\nShared libs\nAll shared")).RightPosZ(-8, 256).TopPosZ(256, 15)) - ITEM(LabelBox, dv___27, SetLabel(t_("Release mode defaults")).RightPosZ(8, 620).TopPosZ(240, 40)) - UNTYPED(release_blitz, SwitchImage(false).SetLabel(t_("&Use BLITZ")).RightPosZ(364, 256).TopPosZ(256, 15)) - ITEM(Label, dv___29, SetLabel(t_("Optimize for speed:")).RightPosZ(520, 108).TopPosZ(284, 19)) - ITEM(EditString, speed_options, RightPosZ(8, 504).TopPosZ(284, 19)) - ITEM(Label, dv___31, SetLabel(t_("Optimize for size:")).RightPosZ(520, 108).TopPosZ(304, 19)) - ITEM(EditString, size_options, RightPosZ(8, 504).TopPosZ(304, 19)) - ITEM(Label, dv___33, SetLabel(t_("Release fixed flags:")).RightPosZ(520, 108).TopPosZ(324, 19)) - ITEM(EditString, release_flags, RightPosZ(8, 504).TopPosZ(324, 19)) - ITEM(Label, dv___35, SetLabel(t_("Release link options:")).RightPosZ(520, 108).TopPosZ(344, 19)) - ITEM(EditString, release_link, RightPosZ(8, 504).TopPosZ(344, 19)) + ITEM(Label, dv___7, SetLabel(t_("Common options")).LeftPosZ(160, 108).TopPosZ(28, 19)) + ITEM(EditString, common_options, HSizePosZ(276, 8).TopPosZ(28, 19)) + ITEM(Label, dv___9, SetLabel(t_("Common C++ options")).LeftPosZ(160, 116).TopPosZ(48, 19)) + ITEM(EditString, common_cpp_options, HSizePosZ(276, 8).TopPosZ(48, 19)) + ITEM(Label, dv___11, SetLabel(t_("Common C options")).LeftPosZ(160, 108).TopPosZ(68, 19)) + ITEM(EditString, common_c_options, HSizePosZ(276, 8).TopPosZ(68, 19)) + ITEM(Label, dv___13, SetLabel(t_("Common fixed flags")).LeftPosZ(160, 108).TopPosZ(88, 19)) + ITEM(EditString, common_flags, HSizePosZ(276, 8).TopPosZ(88, 19)) + ITEM(LabelBox, dv___15, SetLabel(t_("Debug mode defaults")).HSizePosZ(160, 8).TopPosZ(116, 44)) + ITEM(Label, dv___16, SetLabel(t_("Default debug info level:")).LeftPosZ(168, 132).TopPosZ(132, 19)) + ITEM(DropList, debug_info, HSizePosZ(304, 368).TopPosZ(132, 19)) + UNTYPED(debug_blitz, SwitchImage(false).SetLabel(t_("Use BLIT&Z")).HSizePosZ(428, 272).TopPosZ(132, 15)) + UNTYPED(debug_linkmode, SetLabel(t_("All static\nShared libs\nAll shared")).HSizePosZ(540, -4).TopPosZ(132, 15)) + ITEM(Label, dv___20, SetLabel(t_("&Debug options:")).LeftPosZ(160, 100).TopPosZ(164, 19)) + ITEM(EditString, debug_options, HSizePosZ(276, 8).TopPosZ(164, 19)) + ITEM(Label, dv___22, SetLabel(t_("Debug fixed flags:")).LeftPosZ(160, 100).TopPosZ(184, 19)) + ITEM(EditString, debug_flags, HSizePosZ(276, 8).TopPosZ(184, 19)) + ITEM(Label, dv___24, SetLabel(t_("Debug link options:")).LeftPosZ(160, 100).TopPosZ(204, 19)) + ITEM(EditString, debug_link, HSizePosZ(276, 8).TopPosZ(204, 19)) + UNTYPED(release_linkmode, SetLabel(t_("All static\nShared libs\nAll shared")).RightPosZ(-8, 256).TopPosZ(248, 15)) + ITEM(LabelBox, dv___27, SetLabel(t_("Release mode defaults")).RightPosZ(8, 620).TopPosZ(232, 40)) + UNTYPED(release_blitz, SwitchImage(false).SetLabel(t_("&Use BLITZ")).RightPosZ(364, 256).TopPosZ(248, 15)) + ITEM(Label, dv___29, SetLabel(t_("Optimize for speed:")).RightPosZ(520, 108).TopPosZ(276, 19)) + ITEM(EditString, speed_options, RightPosZ(8, 504).TopPosZ(276, 19)) + ITEM(Label, dv___31, SetLabel(t_("Optimize for size:")).RightPosZ(520, 108).TopPosZ(296, 19)) + ITEM(EditString, size_options, RightPosZ(8, 504).TopPosZ(296, 19)) + ITEM(Label, dv___33, SetLabel(t_("Release fixed flags:")).RightPosZ(520, 108).TopPosZ(316, 19)) + ITEM(EditString, release_flags, RightPosZ(8, 504).TopPosZ(316, 19)) + ITEM(Label, dv___35, SetLabel(t_("Release link options:")).RightPosZ(520, 108).TopPosZ(336, 19)) + ITEM(EditString, release_link, RightPosZ(8, 504).TopPosZ(336, 19)) UNTYPED(linkmode_lock, LeftPosZ(4, 148).BottomPosZ(156, 20)) ITEM(Label, dv___38, SetLabel(t_("Script file:")).LeftPosZ(4, 68).BottomPosZ(133, 19)) ITEM(EditField, scriptfile, LeftPosZ(4, 152).BottomPosZ(113, 19)) @@ -219,6 +219,7 @@ LAYOUT(BuildMethodsLayout, 788, 560) ITEM(TabCtrl, paths, HSizePosZ(160, 8).VSizePosZ(376, 40)) ITEM(Button, ok, SetLabel(t_("OK")).RightPosZ(76, 64).BottomPosZ(10, 22)) ITEM(Button, cancel, SetLabel(t_("Cancel")).RightPosZ(8, 64).BottomPosZ(10, 22)) + UNTYPED(allow_pch, LeftPosZ(160, 212).TopPosZ(356, 16)) END_LAYOUT LAYOUT(ModePaneLayout, 288, 460) diff --git a/uppsrc/ide/idewin.cpp b/uppsrc/ide/idewin.cpp index caa164286..1813308c6 100644 --- a/uppsrc/ide/idewin.cpp +++ b/uppsrc/ide/idewin.cpp @@ -156,6 +156,12 @@ bool Ide::IdeConsoleWait() return console.Wait(); } +bool Ide::IdeConsoleWait(int slot) +{ + console.Wait(slot); + return true; +} + void Ide::IdeSetRight(Ctrl& ctrl) { right.Add(ctrl.SizePos());