forked from OctaForge/OctaBuild
API updates
parent
27ec4d2aa0
commit
8f75459529
22
main.cc
22
main.cc
|
@ -26,8 +26,8 @@ using ostd::Mutex;
|
||||||
using ostd::Condition;
|
using ostd::Condition;
|
||||||
|
|
||||||
using cscript::CsState;
|
using cscript::CsState;
|
||||||
using cscript::TvalRange;
|
using cscript::CsValueRange;
|
||||||
using cscript::TaggedValue;
|
using cscript::CsValue;
|
||||||
using cscript::StackedValue;
|
using cscript::StackedValue;
|
||||||
using cscript::BytecodeRef;
|
using cscript::BytecodeRef;
|
||||||
using cscript::Bytecode;
|
using cscript::Bytecode;
|
||||||
|
@ -541,21 +541,21 @@ struct ObState: CsState {
|
||||||
}
|
}
|
||||||
|
|
||||||
void register_rulecmds() {
|
void register_rulecmds() {
|
||||||
add_command("rule", "sse", [this](TvalRange args, TaggedValue &) {
|
add_command("rule", "sse", [this](CsValueRange args, CsValue &) {
|
||||||
rule_add(
|
rule_add(
|
||||||
args[0].get_strr(), args[1].get_strr(), args[2].get_code()
|
args[0].get_strr(), args[1].get_strr(), args[2].get_code()
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
add_command("action", "se", [this](TvalRange args, TaggedValue &) {
|
add_command("action", "se", [this](CsValueRange args, CsValue &) {
|
||||||
rule_add(args[0].get_strr(), nullptr, args[1].get_code(), true);
|
rule_add(args[0].get_strr(), nullptr, args[1].get_code(), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
add_command("depend", "ss", [this](TvalRange args, TaggedValue &) {
|
add_command("depend", "ss", [this](CsValueRange args, CsValue &) {
|
||||||
rule_add(args[0].get_strr(), args[1].get_strr(), nullptr);
|
rule_add(args[0].get_strr(), args[1].get_strr(), nullptr);
|
||||||
});
|
});
|
||||||
|
|
||||||
add_command("duprule", "sssN", [this](TvalRange args, TaggedValue &) {
|
add_command("duprule", "sssN", [this](CsValueRange args, CsValue &) {
|
||||||
rule_dup(
|
rule_dup(
|
||||||
args[0].get_strr(), args[1].get_strr(),
|
args[0].get_strr(), args[1].get_strr(),
|
||||||
args[2].get_strr(), args[3].get_int() <= 2
|
args[2].get_strr(), args[3].get_int() <= 2
|
||||||
|
@ -640,7 +640,7 @@ int main(int argc, char **argv) {
|
||||||
os.register_rulecmds();
|
os.register_rulecmds();
|
||||||
|
|
||||||
os.add_command("shell", "C", [&os, &tpool](
|
os.add_command("shell", "C", [&os, &tpool](
|
||||||
TvalRange args, TaggedValue &res
|
CsValueRange args, CsValue &res
|
||||||
) {
|
) {
|
||||||
auto cnt = os.counters.back();
|
auto cnt = os.counters.back();
|
||||||
cnt->incr();
|
cnt->incr();
|
||||||
|
@ -654,7 +654,7 @@ int main(int argc, char **argv) {
|
||||||
res.set_int(0);
|
res.set_int(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
os.add_command("getenv", "ss", [&os](TvalRange args, TaggedValue &res) {
|
os.add_command("getenv", "ss", [&os](CsValueRange args, CsValue &res) {
|
||||||
if (os.ignore_env) {
|
if (os.ignore_env) {
|
||||||
res.set_cstr("");
|
res.set_cstr("");
|
||||||
return;
|
return;
|
||||||
|
@ -664,7 +664,7 @@ int main(int argc, char **argv) {
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
os.add_command("extreplace", "sss", [&os](TvalRange args, TaggedValue &res) {
|
os.add_command("extreplace", "sss", [&os](CsValueRange args, CsValue &res) {
|
||||||
ConstCharRange lst = args[0].get_strr();
|
ConstCharRange lst = args[0].get_strr();
|
||||||
ConstCharRange oldext = args[1].get_strr();
|
ConstCharRange oldext = args[1].get_strr();
|
||||||
ConstCharRange newext = args[2].get_strr();
|
ConstCharRange newext = args[2].get_strr();
|
||||||
|
@ -692,11 +692,11 @@ int main(int argc, char **argv) {
|
||||||
res.set_str(ostd::move(ret));
|
res.set_str(ostd::move(ret));
|
||||||
});
|
});
|
||||||
|
|
||||||
os.add_command("invoke", "s", [&os](TvalRange args, TaggedValue &res) {
|
os.add_command("invoke", "s", [&os](CsValueRange args, CsValue &res) {
|
||||||
res.set_int(os.exec_main(args[0].get_strr()));
|
res.set_int(os.exec_main(args[0].get_strr()));
|
||||||
});
|
});
|
||||||
|
|
||||||
os.add_command("glob", "C", [&os](TvalRange args, TaggedValue &res) {
|
os.add_command("glob", "C", [&os](CsValueRange args, CsValue &res) {
|
||||||
auto fnames = cscript::util::list_explode(args[0].get_strr());
|
auto fnames = cscript::util::list_explode(args[0].get_strr());
|
||||||
res.set_str(ostd::move(ob_expand_globs(fnames)));
|
res.set_str(ostd::move(ob_expand_globs(fnames)));
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue