use ConstCharRange
parent
c6dd8111bb
commit
3d9bbc465a
7
main.cc
7
main.cc
|
@ -327,7 +327,8 @@ struct ObState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rule_dup(const char *tgt, const char *ptgt, const char *dep) {
|
void rule_dup(ConstCharRange tgt, ConstCharRange ptgt, ConstCharRange dep,
|
||||||
|
bool inherit_deps) {
|
||||||
Rule *oldr = nullptr;
|
Rule *oldr = nullptr;
|
||||||
for (auto &rule: rules.iter())
|
for (auto &rule: rules.iter())
|
||||||
if (ptgt == rule.target)
|
if (ptgt == rule.target)
|
||||||
|
@ -338,7 +339,7 @@ struct ObState {
|
||||||
r.target = tgt;
|
r.target = tgt;
|
||||||
r.action = oldr->action;
|
r.action = oldr->action;
|
||||||
r.func = oldr->func;
|
r.func = oldr->func;
|
||||||
r.deps = dep ? cscript::util::list_explode(dep) : oldr->deps;
|
r.deps = inherit_deps ? oldr->deps : cscript::util::list_explode(dep);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -443,7 +444,7 @@ int main(int argc, char **argv) {
|
||||||
os.cs.add_command("duprule", "sssN", [](CsState &cs, const char *tgt,
|
os.cs.add_command("duprule", "sssN", [](CsState &cs, const char *tgt,
|
||||||
const char *ptgt, const char *dep,
|
const char *ptgt, const char *dep,
|
||||||
int *numargs) {
|
int *numargs) {
|
||||||
((ObState &)cs).rule_dup(tgt, ptgt, (*numargs > 2) ? dep : nullptr);
|
((ObState &)cs).rule_dup(tgt, ptgt, dep, *numargs <= 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
os.cs.add_commandn("getenv", "ss", [](CsState &cs, TvalRange args) {
|
os.cs.add_commandn("getenv", "ss", [](CsState &cs, TvalRange args) {
|
||||||
|
|
Loading…
Reference in New Issue