diff --git a/uppsrc/ide/Build.cpp b/uppsrc/ide/Build.cpp index c071abb6a..e9fc2e05e 100644 --- a/uppsrc/ide/Build.cpp +++ b/uppsrc/ide/Build.cpp @@ -30,6 +30,7 @@ void Ide::BeginBuilding(bool clear_console) { SetupDefaultMethod(); HdependTimeDirty(); + Builder::cmdx_cache.Clear(); Renumber(); StopDebug(); ShowConsole(); diff --git a/uppsrc/ide/Builders/Build.cpp b/uppsrc/ide/Builders/Build.cpp index 08e80e676..0b69aa660 100644 --- a/uppsrc/ide/Builders/Build.cpp +++ b/uppsrc/ide/Builders/Build.cpp @@ -444,6 +444,7 @@ Vector MakeBuild::GetAllLibraries(const Workspace& wspc, int index, bool MakeBuild::Build(const Workspace& wspc, String mainparam, String outfile, bool clear_console) { InitBlitz(); + Builder::cmdx_cache.Clear(); String hfile = outfile + ".xxx"; SaveFile(hfile, ""); diff --git a/uppsrc/ide/Core/Builder.cpp b/uppsrc/ide/Core/Builder.cpp index 9cb89c446..32d6ed88d 100644 --- a/uppsrc/ide/Core/Builder.cpp +++ b/uppsrc/ide/Core/Builder.cpp @@ -32,6 +32,8 @@ Time Builder::GetFileTime(const String& path) const return GetFileInfo(path); } +VectorMap Builder::cmdx_cache; + String Builder::CmdX(const char *s) { // expand ` character delimited sections by executing them as commands String r, cmd; @@ -39,7 +41,15 @@ String Builder::CmdX(const char *s) for(; *s; s++) if(*s == '`') { if(cmdf) { - r << Sys(cmd); + int q = cmdx_cache.Find(cmd); + if(q >= 0) + r << cmdx_cache[q]; + else { + String h = Sys(cmd); + r << h; + cmdx_cache.Add(cmd, h); + IdeProcessEvents(); + } cmd.Clear(); } cmdf = !cmdf; diff --git a/uppsrc/ide/Core/Core.h b/uppsrc/ide/Core/Core.h index 2896c91bb..55d19e2ec 100644 --- a/uppsrc/ide/Core/Core.h +++ b/uppsrc/ide/Core/Core.h @@ -179,6 +179,8 @@ public: virtual bool IdeConsoleWait() = 0; virtual bool IdeConsoleWait(int slot) = 0; virtual void IdeConsoleOnFinish(Event<> cb) = 0; + + virtual void IdeProcessEvents() = 0; virtual bool IdeIsDebug() const = 0; virtual void IdeEndDebug() = 0; @@ -243,6 +245,8 @@ bool IdeConsoleWait(); bool IdeConsoleWait(int slot); void IdeConsoleOnFinish(Event<> cb); +void IdeProcessEvents(); + String GetSourcePackage(const String& path); String GetDefaultMethod(); @@ -576,6 +580,8 @@ struct Builder { Vector Macro; VectorMap tmpfilei; // for naming automatic response files + + static VectorMap cmdx_cache; // caching e.g. pkg-config String CmdX(const char *s); diff --git a/uppsrc/ide/Core/Ide.cpp b/uppsrc/ide/Core/Ide.cpp index ff4e18173..263bc87be 100644 --- a/uppsrc/ide/Core/Ide.cpp +++ b/uppsrc/ide/Core/Ide.cpp @@ -11,6 +11,8 @@ void PutVerbose(const char *s) { if(the_ide) the_ide->PutVerbose(s); } void PutLinking() { if(the_ide) the_ide->PutLinking(); } void PutLinkingEnd(bool ok) { if(the_ide) the_ide->PutLinkingEnd(ok); } +void IdeProcessEvents() { if(the_ide) the_ide->IdeProcessEvents(); } + const Workspace& GetIdeWorkspace() { if(the_ide) diff --git a/uppsrc/ide/ide.h b/uppsrc/ide/ide.h index cc93dd87a..e5a7c7b3f 100644 --- a/uppsrc/ide/ide.h +++ b/uppsrc/ide/ide.h @@ -399,6 +399,7 @@ public: virtual bool IdeConsoleWait(); virtual bool IdeConsoleWait(int slot); virtual void IdeConsoleOnFinish(Event<> cb); + virtual void IdeProcessEvents(); virtual bool IdeIsDebug() const; virtual void IdeEndDebug(); diff --git a/uppsrc/ide/idewin.cpp b/uppsrc/ide/idewin.cpp index 2a18beb2d..318e18d1e 100644 --- a/uppsrc/ide/idewin.cpp +++ b/uppsrc/ide/idewin.cpp @@ -135,6 +135,11 @@ void Ide::IdeConsoleOnFinish(Event<> cb) console.OnFinish(cb); } +void Ide::IdeProcessEvents() +{ + Ctrl::ProcessEvents(); +} + void Ide::IdeSetRight(Ctrl& ctrl) { right.Add(ctrl.SizePos());