master
Daniel Kolesa 2015-12-23 13:52:27 +01:00
parent 5cf74abac6
commit 649745d33c
1 changed files with 7 additions and 6 deletions

13
main.cc
View File

@ -24,6 +24,7 @@ using ostd::slice_until;
using cscript::CsState; using cscript::CsState;
using cscript::TvalRange; using cscript::TvalRange;
using cscript::StackedValue; using cscript::StackedValue;
using cscript::Bytecode;
/* thread pool */ /* thread pool */
@ -160,10 +161,10 @@ private:
/* check funcs */ /* check funcs */
static bool ob_check_ts(ConstCharRange tname, const Vector<String> &deps) { static bool ob_check_ts(ConstCharRange tname, const Vector<String> &deps) {
auto get_ts = [](ConstCharRange fname) -> time_t { auto get_ts = [](ConstCharRange fname) {
ostd::FileInfo fi(fname); ostd::FileInfo fi(fname);
if (fi.type() != ostd::FileType::regular) if (fi.type() != ostd::FileType::regular)
return 0; return time_t(0);
return fi.mtime(); return fi.mtime();
}; };
time_t tts = get_ts(tname); time_t tts = get_ts(tname);
@ -237,7 +238,7 @@ struct ObState: CsState {
struct Rule { struct Rule {
String target; String target;
Vector<String> deps; Vector<String> deps;
cscript::Bytecode func; Bytecode func;
bool action; bool action;
Rule(): target(), deps(), func(), action(false) {} Rule(): target(), deps(), func(), action(false) {}
@ -315,7 +316,7 @@ struct ObState: CsState {
if (!lp.empty()) { if (!lp.empty()) {
repd.append(slice_until(atgt, lp)); repd.append(slice_until(atgt, lp));
repd.append(sr.sub); repd.append(sr.sub);
lp.pop_front(); ++lp;
if (!lp.empty()) repd.append(lp); if (!lp.empty()) repd.append(lp);
atgt = repd.iter(); atgt = repd.iter();
} }
@ -331,7 +332,7 @@ struct ObState: CsState {
int ret = wait_result([&rlist, &subdeps, &tname, this]() { int ret = wait_result([&rlist, &subdeps, &tname, this]() {
return exec_list(rlist, subdeps, tname); return exec_list(rlist, subdeps, tname);
}); });
cscript::Bytecode *func = nullptr; Bytecode *func = nullptr;
bool act = false; bool act = false;
for (auto &sr: rlist.iter()) { for (auto &sr: rlist.iter()) {
Rule &r = *sr.rule; Rule &r = *sr.rule;
@ -349,7 +350,7 @@ struct ObState: CsState {
targetv.set_cstr(tname); targetv.set_cstr(tname);
targetv.push(); targetv.push();
if (subdeps.size() > 0) { if (!subdeps.empty()) {
if (!sourcev.alias(*this, "source")) if (!sourcev.alias(*this, "source"))
return 1; return 1;
if (!sourcesv.alias(*this, "sources")) if (!sourcesv.alias(*this, "sources"))