umk fixed

git-svn-id: svn://ultimatepp.org/upp/trunk@8048 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2015-01-16 18:33:05 +00:00
parent e81b1d1dd2
commit 2ab4268f05
3 changed files with 39 additions and 0 deletions

View file

@ -8,6 +8,7 @@ Console::Console() {
console_lock = -1;
wrap_text = true;
console = false;
serial = 0;
}
void Console::Append(const String& s) {
@ -144,6 +145,7 @@ bool Console::Run(One<AProcess> process, const char *cmdline, Stream *out, bool
pslot.key = key;
pslot.group = current_group;
pslot.last_msecs = msecs();
pslot.serial = ++serial;
groups.GetAdd(pslot.group).count += blitz_count;
if(processes.GetCount() == 1)
Wait(slot);
@ -218,6 +220,13 @@ bool Console::Wait()
}
}
void Console::OnFinish(Callback cb)
{
Finisher& f = finisher.Add();
f.serial = serial;
f.cb = cb;
}
void Console::Kill()
{
for(int i = 0; i < processes.GetCount(); i++)
@ -239,6 +248,20 @@ void Console::Kill(int islot)
FlushConsole();
}
CheckEndGroup();
int minserial = INT_MAX;
for(int i = 0; i < processes.GetCount(); i++)
minserial = min(processes[i].serial, minserial);
int i = 0;
while(i < finisher.GetCount()) {
const Finisher& f = finisher[i];
if(f.serial > minserial)
i++;
else {
f.cb();
finisher.Remove(i);
}
}
}
void Console::SetSlots(int s)

View file

@ -87,6 +87,11 @@ bool Ide::IdeConsoleWait(int slot)
return true;
}
void Ide::IdeConsoleOnFinish(Callback cb)
{
console.OnFinish(cb);
}
bool Ide::IdeIsDebug() const
{
return false;

View file

@ -22,6 +22,7 @@ protected:
bool quiet;
int exitcode;
int last_msecs;
int serial;
};
struct Group {
@ -34,13 +35,20 @@ protected:
int raw_msecs;
};
struct Finisher {
int serial;
Callback cb;
};
Array<Slot> processes;
Array<Finisher> finisher;
ArrayMap<String, Group> groups;
Vector<String> error_keys;
String current_group;
String spooled_output;
int console_lock;
bool wrap_text;
int serial;
void CheckEndGroup();
void FlushConsole();
@ -70,6 +78,8 @@ public:
void Wait(int slot);
bool Wait();
void OnFinish(Callback cb);
void WrapText(bool w) { wrap_text = w; }
void SetSlots(int s);
@ -105,6 +115,7 @@ struct Ide : public IdeContext, public MakeBuild {
virtual void IdeConsoleEndGroup();
virtual bool IdeConsoleWait();
virtual bool IdeConsoleWait(int slot);
virtual void IdeConsoleOnFinish(Callback cb);
virtual bool IdeIsDebug() const ;
virtual void IdeEndDebug();