update to latest ostd

master
Daniel Kolesa 2017-01-25 01:57:33 +01:00
parent 57478f6866
commit d14c8f8593
13 changed files with 113 additions and 113 deletions

View File

@ -371,7 +371,7 @@ struct OSTD_EXPORT CsState {
template<typename F>
CsHookCb set_call_hook(F &&f) {
return set_call_hook(CsHookCb(
ostd::allocator_arg, CsAllocator<char>(*this), ostd::forward<F>(f)
ostd::allocator_arg, CsAllocator<char>(*this), std::forward<F>(f)
));
}
@ -401,7 +401,7 @@ struct OSTD_EXPORT CsState {
ostd::ConstCharRange n, CsInt m, CsInt x, CsInt v, F &&f, int flags = 0
) {
return new_ivar(n, m, x, v, CsVarCb(
ostd::allocator_arg, CsAllocator<char>(*this), ostd::forward<F>(f)
ostd::allocator_arg, CsAllocator<char>(*this), std::forward<F>(f)
), flags);
}
template<typename F>
@ -410,15 +410,15 @@ struct OSTD_EXPORT CsState {
int flags = 0
) {
return new_fvar(n, m, x, v, CsVarCb(
ostd::allocator_arg, CsAllocator<char>(*this), ostd::forward<F>(f)
ostd::allocator_arg, CsAllocator<char>(*this), std::forward<F>(f)
), flags);
}
template<typename F>
CsSvar *new_svar(
ostd::ConstCharRange n, CsString v, F &&f, int flags = 0
) {
return new_svar(n, ostd::move(v), CsVarCb(
ostd::allocator_arg, CsAllocator<char>(*this), ostd::forward<F>(f)
return new_svar(n, std::move(v), CsVarCb(
ostd::allocator_arg, CsAllocator<char>(*this), std::forward<F>(f)
), flags);
}
@ -431,7 +431,7 @@ struct OSTD_EXPORT CsState {
ostd::ConstCharRange name, ostd::ConstCharRange args, F &&f
) {
return new_command(name, args, CsCommandCb(
ostd::allocator_arg, CsAllocator<char>(*this), ostd::forward<F>(f)
ostd::allocator_arg, CsAllocator<char>(*this), std::forward<F>(f)
));
}
@ -596,7 +596,7 @@ struct CsErrorException {
CsErrorException() = delete;
CsErrorException(CsErrorException const &) = delete;
CsErrorException(CsErrorException &&v):
p_errmsg(v.p_errmsg), p_stack(ostd::move(v.p_stack))
p_errmsg(v.p_errmsg), p_stack(std::move(v.p_stack))
{}
ostd::ConstCharRange what() const {
@ -624,7 +624,7 @@ struct CsErrorException {
{
char fbuf[512];
auto ret = ostd::format(
ostd::CharRange(fbuf, sizeof(fbuf)), msg, ostd::forward<A>(args)...
ostd::CharRange(fbuf, sizeof(fbuf)), msg, std::forward<A>(args)...
);
if ((ret < 0) || (ostd::Size(ret) > sizeof(fbuf))) {
p_errmsg = save_msg(cs, msg);
@ -776,7 +776,7 @@ namespace util {
template<typename R>
ostd::Size get_item(R &&writer) const {
if (!p_quote.empty() && (*p_quote == '"')) {
return unescape_string(ostd::forward<R>(writer), p_item);
return unescape_string(std::forward<R>(writer), p_item);
} else {
return writer.put_n(p_item.data(), p_item.size());
}
@ -785,7 +785,7 @@ namespace util {
CsString get_item() const {
auto app = ostd::appender<CsString>();
get_item(app);
return ostd::move(app.get());
return std::move(app.get());
}
ostd::ConstCharRange &get_raw_item(bool quoted = false) {
@ -809,13 +809,13 @@ private:
template<typename R>
inline ostd::Ptrdiff format_int(R &&writer, CsInt val) {
return ostd::format(ostd::forward<R>(writer), IntFormat, val);
return ostd::format(std::forward<R>(writer), IntFormat, val);
}
template<typename R>
inline ostd::Ptrdiff format_float(R &&writer, CsFloat val) {
return ostd::format(
ostd::forward<R>(writer),
std::forward<R>(writer),
(val == CsInt(val)) ? RoundFloatFormat : FloatFormat, val
);
}
@ -831,7 +831,7 @@ private:
switch (vals[i].get_type()) {
case CsValueType::Int: {
auto r = format_int(
ostd::forward<R>(writer), vals[i].get_int()
std::forward<R>(writer), vals[i].get_int()
);
if (r > 0) {
ret += ostd::Size(r);
@ -840,7 +840,7 @@ private:
}
case CsValueType::Float: {
auto r = format_float(
ostd::forward<R>(writer), vals[i].get_float()
std::forward<R>(writer), vals[i].get_float()
);
if (r > 0) {
ret += ostd::Size(r);

View File

@ -26,7 +26,7 @@ CsString GenState::get_str_dup(bool unescape) {
} else {
app.get() = str;
}
return ostd::move(app.get());
return std::move(app.get());
}
ostd::ConstCharRange GenState::read_macro_name() {
@ -483,7 +483,7 @@ static bool compileblockstr(GenState &gs, ostd::ConstCharRange str, bool macro)
int startc = gs.code.size();
gs.code.push_back(macro ? CsCodeMacro : CsCodeVal | CsRetString);
gs.code.reserve(gs.code.size() + str.size() / sizeof(ostd::Uint32) + 1);
char *buf = new char[str.size() / sizeof(ostd::Uint32) + 1];
char *buf = new char[(str.size() / sizeof(uint32_t) + 1) * sizeof(uint32_t)];
int len = 0;
while (!str.empty()) {
char const *p = str.data();

View File

@ -24,7 +24,7 @@ CsFloat cs_parse_float(
template<typename F>
struct CsScopeExit {
template<typename FF>
CsScopeExit(FF &&f): func(ostd::forward<FF>(f)) {}
CsScopeExit(FF &&f): func(std::forward<FF>(f)) {}
~CsScopeExit() {
func();
}
@ -33,7 +33,7 @@ struct CsScopeExit {
template<typename F1, typename F2>
inline void cs_do_and_cleanup(F1 &&dof, F2 &&clf) {
CsScopeExit<F2> cleanup(ostd::forward<F2>(clf));
CsScopeExit<F2> cleanup(std::forward<F2>(clf));
dof();
}

View File

@ -41,7 +41,7 @@ CsValue::CsValue(CsValue const &v): CsValue() {
}
CsValue::CsValue(CsValue &&v): CsValue() {
*this = ostd::move(v);
*this = std::move(v);
}
CsValue &CsValue::operator=(CsValue const &v) {
@ -197,10 +197,10 @@ ostd::ConstCharRange CsValue::force_str() {
CsString rs;
switch (get_type()) {
case CsValueType::Float:
rs = ostd::move(floatstr(csv_get<CsFloat>(p_stor)));
rs = std::move(floatstr(csv_get<CsFloat>(p_stor)));
break;
case CsValueType::Int:
rs = ostd::move(intstr(csv_get<CsInt>(p_stor)));
rs = std::move(intstr(csv_get<CsInt>(p_stor)));
break;
case CsValueType::Macro:
case CsValueType::Cstring:
@ -211,7 +211,7 @@ ostd::ConstCharRange CsValue::force_str() {
default:
break;
}
set_str(ostd::move(rs));
set_str(std::move(rs));
return ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len);
}
@ -383,7 +383,7 @@ CsStackedValue &CsStackedValue::operator=(CsValue const &v) {
}
CsStackedValue &CsStackedValue::operator=(CsValue &&v) {
*static_cast<CsValue *>(this) = ostd::move(v);
*static_cast<CsValue *>(this) = std::move(v);
return *this;
}

View File

@ -431,7 +431,7 @@ static inline void callcommand(
auto buf = ostd::appender<CsString>();
cscript::util::tvals_concat(buf, ostd::iter(args, i), " ");
CsValue tv;
tv.set_str(ostd::move(buf.get()));
tv.set_str(std::move(buf.get()));
CsCommandInternal::call(cs, id, CsValueRange(&tv, 1), res);
return;
}
@ -666,7 +666,7 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
force_arg(result, op & CsCodeRetMask);
/* fallthrough */
case CsCodeResultArg | CsRetNull:
args[numargs++] = ostd::move(result);
args[numargs++] = std::move(result);
continue;
case CsCodePrint:
cs.print_var(static_cast<CsVar *>(cs.p_state->identmap[op >> 8]));
@ -731,7 +731,7 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
if (args[numargs].get_type() == CsValueType::Code) {
cs.run(args[numargs].get_code(), result);
} else {
result = ostd::move(args[numargs]);
result = std::move(args[numargs]);
}
if (result.get_bool()) {
code += len;
@ -744,7 +744,7 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
if (args[numargs].get_type() == CsValueType::Code) {
cs.run(args[numargs].get_code(), result);
} else {
result = ostd::move(args[numargs]);
result = std::move(args[numargs]);
}
if (!result.get_bool()) {
code += len;
@ -829,7 +829,7 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
numargs++;
continue;
case CsCodeDup | CsRetString:
args[numargs].set_str(ostd::move(args[numargs - 1].get_str()));
args[numargs].set_str(std::move(args[numargs - 1].get_str()));
numargs++;
continue;
@ -844,12 +844,12 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
continue;
case CsCodeResult | CsRetNull:
result = ostd::move(args[--numargs]);
result = std::move(args[--numargs]);
continue;
case CsCodeResult | CsRetString:
case CsCodeResult | CsRetInt:
case CsCodeResult | CsRetFloat:
result = ostd::move(args[--numargs]);
result = std::move(args[--numargs]);
force_arg(result, op & CsCodeRetMask);
continue;
@ -994,7 +994,7 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
CsValue &arg = args[numargs - 1];
switch (cs_get_lookupu_type(cs, arg, id, op)) {
case CsIdAlias:
arg.set_str(ostd::move(
arg.set_str(std::move(
static_cast<CsAlias *>(id)->get_value().get_str()
));
continue;
@ -1002,12 +1002,12 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
arg.set_str(static_cast<CsSvar *>(id)->get_value());
continue;
case CsIdIvar:
arg.set_str(ostd::move(
arg.set_str(std::move(
intstr(static_cast<CsIvar *>(id)->get_value())
));
continue;
case CsIdFvar:
arg.set_str(ostd::move(
arg.set_str(std::move(
floatstr(static_cast<CsFvar *>(id)->get_value())
));
continue;
@ -1020,7 +1020,7 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
}
case CsCodeLookup | CsRetString:
args[numargs++].set_str(
ostd::move(cs_get_lookup_id(cs, op)->get_value().get_str())
std::move(cs_get_lookup_id(cs, op)->get_value().get_str())
);
continue;
case CsCodeLookupArg | CsRetString: {
@ -1029,7 +1029,7 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
args[numargs++].set_str("");
} else {
args[numargs++].set_str(
ostd::move(a->get_value().get_str())
std::move(a->get_value().get_str())
);
}
continue;
@ -1171,12 +1171,12 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
arg.set_cstr(static_cast<CsSvar *>(id)->get_value());
continue;
case CsIdIvar:
arg.set_str(ostd::move(
arg.set_str(std::move(
intstr(static_cast<CsIvar *>(id)->get_value())
));
continue;
case CsIdFvar:
arg.set_str(ostd::move(
arg.set_str(std::move(
floatstr(static_cast<CsFvar *>(id)->get_value())
));
continue;
@ -1270,7 +1270,7 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
)->get_value());
continue;
case CsCodeIvar | CsRetString:
args[numargs++].set_str(ostd::move(intstr(static_cast<CsIvar *>(
args[numargs++].set_str(std::move(intstr(static_cast<CsIvar *>(
cs.p_state->identmap[op >> 8]
)->get_value())));
continue;
@ -1309,7 +1309,7 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
)->get_value());
continue;
case CsCodeFvar | CsRetString:
args[numargs++].set_str(ostd::move(floatstr(
args[numargs++].set_str(std::move(floatstr(
static_cast<CsFvar *>(
cs.p_state->identmap[op >> 8]
)->get_value()
@ -1376,7 +1376,7 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
buf, ostd::iter(&args[offset], callargs), " "
);
CsValue tv;
tv.set_str(ostd::move(buf.get()));
tv.set_str(std::move(buf.get()));
CsCommandInternal::call(cs, id, CsValueRange(&tv, 1), result);
}
force_arg(result, op & CsCodeRetMask);
@ -1399,7 +1399,7 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
((op & CsCodeOpMask) == CsCodeConc) ? " " : ""
);
numargs = numargs - numconc;
args[numargs].set_str(ostd::move(buf.get()));
args[numargs].set_str(std::move(buf.get()));
force_arg(args[numargs], op & CsCodeRetMask);
numargs++;
continue;
@ -1415,7 +1415,7 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
buf, ostd::iter(&args[numargs - numconc], numconc)
);
numargs = numargs - numconc;
result.set_str(ostd::move(buf.get()));
result.set_str(std::move(buf.get()));
force_arg(result, op & CsCodeRetMask);
continue;
}
@ -1435,7 +1435,7 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
case CsCodeAliasU:
numargs -= 2;
cs.set_alias(
args[numargs].get_str(), ostd::move(args[numargs + 1])
args[numargs].get_str(), std::move(args[numargs + 1])
);
continue;
@ -1489,7 +1489,7 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
idarg.get_type() != CsValueType::Cstring
) {
litval:
result = ostd::move(idarg);
result = std::move(idarg);
force_arg(result, op & CsCodeRetMask);
numargs = offset - 1;
continue;
@ -1833,7 +1833,7 @@ ostd::Maybe<CsString> CsState::run_file_str(ostd::ConstCharRange fname) {
if (!cs_run_file(*this, fname, ret)) {
return ostd::nothing;
}
return ostd::move(ret.get_str());
return std::move(ret.get_str());
}
ostd::Maybe<CsInt> CsState::run_file_int(ostd::ConstCharRange fname) {

View File

@ -107,7 +107,7 @@ struct CsSharedState {
template<typename T, typename ...A>
T *create(A &&...args) {
T *ret = static_cast<T *>(alloc(nullptr, 0, sizeof(T)));
new (ret) T(ostd::forward<A>(args)...);
new (ret) T(std::forward<A>(args)...);
return ret;
}
@ -321,14 +321,14 @@ struct CsAliasInternal {
) {
if (a->p_astack == &st) {
/* prevent cycles and unnecessary code elsewhere */
a->p_val = ostd::move(v);
a->p_val = std::move(v);
clean_code(a);
return;
}
st.val_s = ostd::move(a->p_val);
st.val_s = std::move(a->p_val);
st.next = a->p_astack;
a->p_astack = &st;
a->p_val = ostd::move(v);
a->p_val = std::move(v);
clean_code(a);
if (um) {
a->p_flags &= ~CsIdfUnknown;
@ -340,31 +340,31 @@ struct CsAliasInternal {
return;
}
CsIdentStack *st = a->p_astack;
a->p_val = ostd::move(a->p_astack->val_s);
a->p_val = std::move(a->p_astack->val_s);
clean_code(a);
a->p_astack = st->next;
}
static void undo_arg(CsAlias *a, CsIdentStack &st) {
CsIdentStack *prev = a->p_astack;
st.val_s = ostd::move(a->p_val);
st.val_s = std::move(a->p_val);
st.next = prev;
a->p_astack = prev->next;
a->p_val = ostd::move(prev->val_s);
a->p_val = std::move(prev->val_s);
clean_code(a);
}
static void redo_arg(CsAlias *a, CsIdentStack &st) {
CsIdentStack *prev = st.next;
prev->val_s = ostd::move(a->p_val);
prev->val_s = std::move(a->p_val);
a->p_astack = prev;
a->p_val = ostd::move(st.val_s);
a->p_val = std::move(st.val_s);
clean_code(a);
}
static void set_arg(CsAlias *a, CsState &cs, CsValue &v) {
if (cs_is_arg_used(cs, a)) {
a->p_val = ostd::move(v);
a->p_val = std::move(v);
clean_code(a);
} else {
push_arg(a, v, cs.p_callstack->argstack[a->get_index()], false);
@ -373,7 +373,7 @@ struct CsAliasInternal {
}
static void set_alias(CsAlias *a, CsState &cs, CsValue &v) {
a->p_val = ostd::move(v);
a->p_val = std::move(v);
clean_code(a);
a->p_flags = (a->p_flags & cs.identflags) | cs.identflags;
}
@ -423,7 +423,7 @@ static void cs_do_args(CsState &cs, F body) {
prevstack ? prevstack->argstack : nullptr
};
cs.p_callstack = &aliaslink;
cs_do_and_cleanup(ostd::move(body), [&]() {
cs_do_and_cleanup(std::move(body), [&]() {
if (prevstack) {
prevstack->usedargs = aliaslink.usedargs;
}

View File

@ -6,13 +6,13 @@ namespace cscript {
CsString intstr(CsInt v) {
auto app = ostd::appender<CsString>();
cscript::util::format_int(app, v);
return ostd::move(app.get());
return std::move(app.get());
}
CsString floatstr(CsFloat v) {
auto app = ostd::appender<CsString>();
cscript::util::format_float(app, v);
return ostd::move(app.get());
return std::move(app.get());
}
bool cs_check_num(ostd::ConstCharRange s) {
@ -35,33 +35,33 @@ CsIdent::CsIdent(CsIdentType tp, ostd::ConstCharRange nm, int fl):
{}
CsVar::CsVar(CsIdentType tp, ostd::ConstCharRange name, CsVarCb f, int fl):
CsIdent(tp, name, fl), cb_var(ostd::move(f))
CsIdent(tp, name, fl), cb_var(std::move(f))
{}
CsIvar::CsIvar(
ostd::ConstCharRange name, CsInt m, CsInt x, CsInt v, CsVarCb f, int fl
):
CsVar(CsIdentType::Ivar, name, ostd::move(f), fl | ((m > x) ? CsIdfReadOnly : 0)),
CsVar(CsIdentType::Ivar, name, std::move(f), fl | ((m > x) ? CsIdfReadOnly : 0)),
p_storage(v), p_minval(m), p_maxval(x), p_overrideval(0)
{}
CsFvar::CsFvar(
ostd::ConstCharRange name, CsFloat m, CsFloat x, CsFloat v, CsVarCb f, int fl
):
CsVar(CsIdentType::Fvar, name, ostd::move(f), fl | ((m > x) ? CsIdfReadOnly : 0)),
CsVar(CsIdentType::Fvar, name, std::move(f), fl | ((m > x) ? CsIdfReadOnly : 0)),
p_storage(v), p_minval(m), p_maxval(x), p_overrideval(0)
{}
CsSvar::CsSvar(ostd::ConstCharRange name, CsString v, CsVarCb f, int fl):
CsVar(CsIdentType::Svar, name, ostd::move(f), fl),
p_storage(ostd::move(v)), p_overrideval()
CsVar(CsIdentType::Svar, name, std::move(f), fl),
p_storage(std::move(v)), p_overrideval()
{}
CsAlias::CsAlias(ostd::ConstCharRange name, CsString a, int fl):
CsIdent(CsIdentType::Alias, name, fl),
p_acode(nullptr), p_astack(nullptr)
{
p_val.set_str(ostd::move(a));
p_val.set_str(std::move(a));
}
CsAlias::CsAlias(ostd::ConstCharRange name, CsInt a, int fl):
CsIdent(CsIdentType::Alias, name, fl),
@ -83,7 +83,7 @@ CsAlias::CsAlias(ostd::ConstCharRange name, int fl):
}
CsAlias::CsAlias(ostd::ConstCharRange name, CsValue v, int fl):
CsIdent(CsIdentType::Alias, name, fl),
p_acode(nullptr), p_astack(nullptr), p_val(ostd::move(v))
p_acode(nullptr), p_astack(nullptr), p_val(std::move(v))
{}
CsCommand::CsCommand(
@ -91,7 +91,7 @@ CsCommand::CsCommand(
int nargs, CsCommandCb f
):
CsIdent(CsIdentType::Command, name, 0),
p_cargs(args), p_cb_cftv(ostd::move(f)), p_numargs(nargs)
p_cargs(args), p_cb_cftv(std::move(f)), p_numargs(nargs)
{}
bool CsIdent::is_alias() const {
@ -234,7 +234,7 @@ CsString CsIvar::to_printable() const {
} else {
format(app, IvarHexFormat, get_name(), i);
}
return ostd::move(app.get());
return std::move(app.get());
}
CsFloat CsFvar::get_val_min() const {
@ -255,14 +255,14 @@ CsString CsFvar::to_printable() const {
CsFloat f = p_storage;
auto app = ostd::appender<CsString>();
format(app, (f == CsInt(f)) ? FvarRoundFormat : FvarFormat, get_name(), f);
return ostd::move(app.get());
return std::move(app.get());
}
ostd::ConstCharRange CsSvar::get_value() const {
return p_storage.iter();
}
void CsSvar::set_value(CsString val) {
p_storage = ostd::move(val);
p_storage = std::move(val);
}
CsString CsSvar::to_printable() const {
@ -273,7 +273,7 @@ CsString CsSvar::to_printable() const {
} else {
format(app, SvarQuotedFormat, get_name(), s);
}
return ostd::move(app.get());
return std::move(app.get());
}
ostd::ConstCharRange CsCommand::get_args() const {
@ -330,7 +330,7 @@ CsState::CsState(CsAllocCb func, void *data):
})->p_type = CsIdIf;
new_command("result", "T", [](auto &, auto args, auto &res) {
res = ostd::move(args[0]);
res = std::move(args[0]);
})->p_type = CsIdResult;
new_command("!", "t", [](auto &, auto args, auto &res) {
@ -346,7 +346,7 @@ CsState::CsState(CsAllocCb func, void *data):
if (code) {
cs.run(code, res);
} else {
res = ostd::move(args[i]);
res = std::move(args[i]);
}
if (!res.get_bool()) {
break;
@ -364,7 +364,7 @@ CsState::CsState(CsAllocCb func, void *data):
if (code) {
cs.run(code, res);
} else {
res = ostd::move(args[i]);
res = std::move(args[i]);
}
if (res.get_bool()) {
break;
@ -411,8 +411,8 @@ CsState::~CsState() {
}
CsHookCb CsState::set_call_hook(CsHookCb func) {
auto hk = ostd::move(p_callhook);
p_callhook = ostd::move(func);
auto hk = std::move(p_callhook);
p_callhook = std::move(func);
return hk;
}
@ -545,7 +545,7 @@ CsIvar *CsState::new_ivar(
ostd::ConstCharRange n, CsInt m, CsInt x, CsInt v, CsVarCb f, int flags
) {
return add_ident(
p_state->create<CsIvar>(n, m, x, v, ostd::move(f), flags)
p_state->create<CsIvar>(n, m, x, v, std::move(f), flags)
)->get_ivar();
}
@ -553,7 +553,7 @@ CsFvar *CsState::new_fvar(
ostd::ConstCharRange n, CsFloat m, CsFloat x, CsFloat v, CsVarCb f, int flags
) {
return add_ident(
p_state->create<CsFvar>(n, m, x, v, ostd::move(f), flags)
p_state->create<CsFvar>(n, m, x, v, std::move(f), flags)
)->get_fvar();
}
@ -561,7 +561,7 @@ CsSvar *CsState::new_svar(
ostd::ConstCharRange n, CsString v, CsVarCb f, int flags
) {
return add_ident(
p_state->create<CsSvar>(n, ostd::move(v), ostd::move(f), flags)
p_state->create<CsSvar>(n, std::move(v), std::move(f), flags)
)->get_svar();
}
@ -614,7 +614,7 @@ void CsState::set_alias(ostd::ConstCharRange name, CsValue v) {
} else if (cs_check_num(name)) {
throw CsErrorException(*this, "cannot alias number %s", name);
} else {
add_ident(p_state->create<CsAlias>(name, ostd::move(v), identflags));
add_ident(p_state->create<CsAlias>(name, std::move(v), identflags));
}
}
@ -632,10 +632,10 @@ void CsAlias::get_cstr(CsValue &v) const {
v.set_cstr(p_val.get_strr());
break;
case CsValueType::Int:
v.set_str(ostd::move(intstr(p_val.get_int())));
v.set_str(std::move(intstr(p_val.get_int())));
break;
case CsValueType::Float:
v.set_str(ostd::move(floatstr(p_val.get_float())));
v.set_str(std::move(floatstr(p_val.get_float())));
break;
default:
v.set_cstr("");
@ -829,7 +829,7 @@ CsState::get_alias_val(ostd::ConstCharRange name) {
if ((a->get_index() < MaxArguments) && !cs_is_arg_used(*this, a)) {
return ostd::nothing;
}
return ostd::move(a->get_value().get_str());
return std::move(a->get_value().get_str());
}
CsInt cs_clamp_var(CsState &cs, CsIvar *iv, CsInt v) {
@ -975,7 +975,7 @@ CsCommand *CsState::new_command(
}
}
return static_cast<CsCommand *>(
add_ident(p_state->create<CsCommand>(name, args, nargs, ostd::move(func)))
add_ident(p_state->create<CsCommand>(name, args, nargs, std::move(func)))
);
}
@ -1031,7 +1031,7 @@ static inline void cs_loop_conc(
s += v.get_str();
}
end:
res.set_str(ostd::move(s));
res.set_str(std::move(s));
}
void cs_init_lib_base(CsState &gcs) {
@ -1055,7 +1055,7 @@ void cs_init_lib_base(CsState &gcs) {
if (e.get_stack().get()) {
auto app = ostd::appender<CsString>();
cscript::util::print_stack(app, e.get_stack());
tback.set_str(ostd::move(app.get()));
tback.set_str(std::move(app.get()));
}
rc = false;
}
@ -1066,9 +1066,9 @@ void cs_init_lib_base(CsState &gcs) {
gcs.new_command("?", "tTT", [](auto &, auto args, auto &res) {
if (args[0].get_bool()) {
res = ostd::move(args[1]);
res = std::move(args[1]);
} else {
res = ostd::move(args[2]);
res = std::move(args[2]);
}
});
@ -1131,7 +1131,7 @@ void cs_init_lib_base(CsState &gcs) {
return;
}
if (args[1].get_bool()) {
idv = ostd::move(args[1]);
idv = std::move(args[1]);
idv.push();
cs.run(args[2].get_code(), res);
}
@ -1274,7 +1274,7 @@ end:
if (!idv.has_alias() || (idv.get_alias()->get_index() < MaxArguments)) {
return;
}
idv = ostd::move(args[1]);
idv = std::move(args[1]);
idv.push();
cs.run(args[2].get_code(), res);
});
@ -1284,7 +1284,7 @@ end:
});
gcs.new_command("alias", "sT", [](auto &cs, auto args, auto &) {
cs.set_alias(args[0].get_strr(), ostd::move(args[1]));
cs.set_alias(args[0].get_strr(), std::move(args[1]));
});
gcs.new_command("getvarmin", "s", [](auto &cs, auto args, auto &res) {
@ -1306,7 +1306,7 @@ end:
gcs.new_command("getalias", "s", [](auto &cs, auto args, auto &res) {
res.set_str(
ostd::move(cs.get_alias_val(args[0].get_strr()).value_or(""))
std::move(cs.get_alias_val(args[0].get_strr()).value_or(""))
);
});
}

View File

@ -95,7 +95,7 @@ static void cs_loop_list_conc(
r += v.get_str();
}
end:
res.set_str(ostd::move(r));
res.set_str(std::move(r));
}
int cs_list_includes(
@ -132,7 +132,7 @@ static inline void cs_list_merge(
buf += p.get_raw_item(true);
}
}
res.set_str(ostd::move(buf));
res.set_str(std::move(buf));
}
static void cs_init_lib_list_sort(CsState &cs);
@ -146,7 +146,7 @@ void cs_init_lib_list(CsState &gcs) {
if (args.empty()) {
return;
}
CsString str = ostd::move(args[0].get_str());
CsString str = std::move(args[0].get_str());
util::ListParser p(cs, str);
p.get_raw_item() = str;
for (ostd::Size i = 1; i < args.size(); ++i) {
@ -398,7 +398,7 @@ end:
r += p.get_raw_item(true);
}
}
res.set_str(ostd::move(r));
res.set_str(std::move(r));
});
gcs.new_command("listcount", "rse", [](auto &cs, auto args, auto &res) {
@ -442,7 +442,7 @@ end:
buf.put(' ');
}
}
res.set_str(ostd::move(buf.get()));
res.set_str(std::move(buf.get()));
});
gcs.new_command("indexof", "ss", [](auto &cs, auto args, auto &res) {
@ -504,7 +504,7 @@ end:
break;
}
}
res.set_str(ostd::move(buf));
res.set_str(std::move(buf));
});
cs_init_lib_list_sort(gcs);
@ -613,7 +613,7 @@ static void cs_list_sort(
}
sorted += item.quote;
}
res.set_str(ostd::move(sorted));
res.set_str(std::move(sorted));
}
static void cs_init_lib_list_sort(CsState &gcs) {

View File

@ -58,7 +58,7 @@ void cs_init_lib_string(CsState &cs) {
for (auto i: ostd::range(s.size())) {
s[i] = tolower(s[i]);
}
res.set_str(ostd::move(s));
res.set_str(std::move(s));
});
cs.new_command("strupper", "s", [](auto &, auto args, auto &res) {
@ -66,31 +66,31 @@ void cs_init_lib_string(CsState &cs) {
for (auto i: ostd::range(s.size())) {
s[i] = toupper(s[i]);
}
res.set_str(ostd::move(s));
res.set_str(std::move(s));
});
cs.new_command("escape", "s", [](auto &, auto args, auto &res) {
auto s = ostd::appender<CsString>();
util::escape_string(s, args[0].get_strr());
res.set_str(ostd::move(s.get()));
res.set_str(std::move(s.get()));
});
cs.new_command("unescape", "s", [](auto &, auto args, auto &res) {
auto s = ostd::appender<CsString>();
util::unescape_string(s, args[0].get_strr());
res.set_str(ostd::move(s.get()));
res.set_str(std::move(s.get()));
});
cs.new_command("concat", "V", [](auto &, auto args, auto &res) {
auto s = ostd::appender<CsString>();
cscript::util::tvals_concat(s, args, " ");
res.set_str(ostd::move(s.get()));
res.set_str(std::move(s.get()));
});
cs.new_command("concatword", "V", [](auto &, auto args, auto &res) {
auto s = ostd::appender<CsString>();
cscript::util::tvals_concat(s, args);
res.set_str(ostd::move(s.get()));
res.set_str(std::move(s.get()));
});
cs.new_command("format", "V", [](auto &, auto args, auto &res) {
@ -118,7 +118,7 @@ void cs_init_lib_string(CsState &cs) {
s += c;
}
}
res.set_str(ostd::move(s));
res.set_str(std::move(s));
});
cs.new_command("tohex", "ii", [](auto &, auto args, auto &res) {
@ -127,7 +127,7 @@ void cs_init_lib_string(CsState &cs) {
r, "0x%.*X", ostd::max(args[1].get_int(), CsInt(1)),
args[0].get_int()
);
res.set_str(ostd::move(r.get()));
res.set_str(std::move(r.get()));
});
cs.new_command("substr", "siiN", [](auto &, auto args, auto &res) {
@ -193,7 +193,7 @@ void cs_init_lib_string(CsState &cs) {
s = found + oldval.size();
} else {
buf += s;
res.set_str(ostd::move(buf));
res.set_str(std::move(buf));
return;
}
}
@ -217,7 +217,7 @@ void cs_init_lib_string(CsState &cs) {
if ((offset + len) < CsInt(s.size())) {
p += s.slice(offset + len, s.size());
}
res.set_str(ostd::move(p));
res.set_str(std::move(p));
});
}

View File

@ -14,7 +14,7 @@ static ostd::Maybe<ostd::String> read_line(CsState &, CsSvar *pr) {
for (char c = ostd::in.getchar(); c && (c != '\n'); c = ostd::in.getchar()) {
ret += c;
}
return ostd::move(ret);
return std::move(ret);
}
static void add_history(CsState &, ostd::ConstCharRange) {

View File

@ -71,7 +71,7 @@ static ostd::Maybe<ostd::String> read_line(CsState &, CsSvar *pr) {
}
ostd::String ret = line;
linenoiseFree(line);
return ostd::move(ret);
return std::move(ret);
}
static void add_history(CsState &, ostd::ConstCharRange line) {

View File

@ -75,7 +75,7 @@ static ostd::Maybe<ostd::String> read_line(CsState &, CsSvar *pr) {
}
ostd::String ret = line;
free(line);
return ostd::move(ret);
return std::move(ret);
}
static void add_history(CsState &, ostd::ConstCharRange line) {

View File

@ -243,7 +243,7 @@ static void do_tty(CsState &cs) {
if (!line) {
return;
}
auto lv = ostd::move(line.value());
auto lv = std::move(line.value());
if (lv.empty()) {
continue;
}