remove CommandFuncS

master
Daniel Kolesa 2016-08-01 00:49:28 +01:00
parent 1c9d3d3aba
commit 14678e0861
2 changed files with 8 additions and 20 deletions

View File

@ -2651,14 +2651,9 @@ static inline void callcommand(CsState &cs, Ident *id, TaggedValue *args, int nu
case 'C': {
i = ostd::max(i + 1, numargs);
ostd::Vector<char> buf;
char *str = conc(buf, ostd::iter(args, i), true);
if (id->flags & IDF_NOEXPAND) {
TaggedValue tv;
tv.set_mstr(str);
id->cb_cftv(cs, TvalRange(&tv, 1));
} else {
id->cb_cfs(cs, str);
}
TaggedValue tv;
tv.set_mstr(conc(buf, ostd::iter(args, i), true));
id->cb_cftv(cs, TvalRange(&tv, 1));
goto cleanup;
}
case 'V':
@ -3231,14 +3226,9 @@ static ostd::Uint32 const *runcode(CsState &cs, ostd::Uint32 const *code, Tagged
{
ostd::Vector<char> buf;
buf.reserve(256);
char *str = conc(buf, ostd::iter(&args[offset], callargs), true);
if (id->flags & IDF_NOEXPAND) {
TaggedValue tv;
tv.set_mstr(str);
id->cb_cftv(cs, TvalRange(&tv, 1));
} else {
id->cb_cfs(cs, str);
}
TaggedValue tv;
tv.set_mstr(conc(buf, ostd::iter(&args[offset], callargs), true));
id->cb_cftv(cs, TvalRange(&tv, 1));
}
result.force(op & CODE_RET_MASK);
free_args(args, numargs, offset);
@ -3625,8 +3615,8 @@ static void cs_init_lib_io(CsState &cso) {
cs.result->set_int(1);
});
cso.add_commandn("echo", "C", [](CsState &, ostd::ConstCharRange s) {
ostd::writeln(s);
cso.add_command("echo", "C", [](CsState &, TvalRange args) {
ostd::writeln(args[0].get_strr());
});
}

View File

@ -174,7 +174,6 @@ using CommandFunc10 = void (*)(CsState &, void *, void *, void *, void *, void *
using CommandFunc11 = void (*)(CsState &, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *);
using CommandFunc12 = void (*)(CsState &, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *);
using CommandFuncTv = void (*)(CsState &, TvalRange);
using CommandFuncS = void (*)(CsState &, ostd::ConstCharRange);
struct OSTD_EXPORT Ident {
ostd::byte type; /* ID_something */
@ -224,7 +223,6 @@ struct OSTD_EXPORT Ident {
CommandFunc11 cb_cf11;
CommandFunc12 cb_cf12;
CommandFuncTv cb_cftv;
CommandFuncS cb_cfs;
};
Ident(): type(ID_UNKNOWN) {}