style update

master
Daniel Kolesa 2016-09-07 19:42:12 +02:00
parent aa367f4a0c
commit 2440d2bb9a
6 changed files with 170 additions and 170 deletions

View File

@ -430,7 +430,7 @@ lookupid:
CsIdent *id = gs.cs.new_ident(lookup.get()); CsIdent *id = gs.cs.new_ident(lookup.get());
if (id) { if (id) {
switch (id->get_type()) { switch (id->get_type()) {
case CsIdentType::ivar: case CsIdentType::Ivar:
gs.code.push( gs.code.push(
CODE_IVAR | cs_ret_code(ltype, RET_INT) | CODE_IVAR | cs_ret_code(ltype, RET_INT) |
(id->get_index() << 8) (id->get_index() << 8)
@ -447,7 +447,7 @@ lookupid:
break; break;
} }
return; return;
case CsIdentType::fvar: case CsIdentType::Fvar:
gs.code.push( gs.code.push(
CODE_FVAR | cs_ret_code(ltype, RET_FLOAT) | CODE_FVAR | cs_ret_code(ltype, RET_FLOAT) |
(id->get_index() << 8) (id->get_index() << 8)
@ -464,7 +464,7 @@ lookupid:
break; break;
} }
return; return;
case CsIdentType::svar: case CsIdentType::Svar:
switch (ltype) { switch (ltype) {
case VAL_POP: case VAL_POP:
return; return;
@ -485,7 +485,7 @@ lookupid:
break; break;
} }
goto done; goto done;
case CsIdentType::alias: case CsIdentType::Alias:
switch (ltype) { switch (ltype) {
case VAL_POP: case VAL_POP:
return; return;
@ -519,7 +519,7 @@ lookupid:
break; break;
} }
goto done; goto done;
case CsIdentType::command: { case CsIdentType::Command: {
int comtype = CODE_COM, numargs = 0; int comtype = CODE_COM, numargs = 0;
if (prevargs >= MaxResults) { if (prevargs >= MaxResults) {
gs.code.push(CODE_ENTER); gs.code.push(CODE_ENTER);
@ -750,16 +750,16 @@ lookupid:
CsIdent *id = gs.cs.new_ident(lookup.get()); CsIdent *id = gs.cs.new_ident(lookup.get());
if (id) { if (id) {
switch (id->get_type()) { switch (id->get_type()) {
case CsIdentType::ivar: case CsIdentType::Ivar:
gs.code.push(CODE_IVAR | (id->get_index() << 8)); gs.code.push(CODE_IVAR | (id->get_index() << 8));
goto done; goto done;
case CsIdentType::fvar: case CsIdentType::Fvar:
gs.code.push(CODE_FVAR | (id->get_index() << 8)); gs.code.push(CODE_FVAR | (id->get_index() << 8));
goto done; goto done;
case CsIdentType::svar: case CsIdentType::Svar:
gs.code.push(CODE_SVARM | (id->get_index() << 8)); gs.code.push(CODE_SVARM | (id->get_index() << 8));
goto done; goto done;
case CsIdentType::alias: case CsIdentType::Alias:
gs.code.push( gs.code.push(
(id->get_index() < MaxArguments (id->get_index() < MaxArguments
? CODE_LOOKUPMARG ? CODE_LOOKUPMARG
@ -1103,7 +1103,7 @@ static void compilestatements(GenState &gs, int rettype, int brak, int prevargs)
CsIdent *id = gs.cs.new_ident(idname.get()); CsIdent *id = gs.cs.new_ident(idname.get());
if (id) { if (id) {
switch (id->get_type()) { switch (id->get_type()) {
case CsIdentType::alias: case CsIdentType::Alias:
more = compilearg(gs, VAL_ANY, prevargs); more = compilearg(gs, VAL_ANY, prevargs);
if (!more) { if (!more) {
gs.gen_str(); gs.gen_str();
@ -1115,7 +1115,7 @@ static void compilestatements(GenState &gs, int rettype, int brak, int prevargs)
) | (id->get_index() << 8) ) | (id->get_index() << 8)
); );
goto endstatement; goto endstatement;
case CsIdentType::ivar: case CsIdentType::Ivar:
more = compilearg(gs, VAL_INT, prevargs); more = compilearg(gs, VAL_INT, prevargs);
if (!more) { if (!more) {
gs.gen_int(); gs.gen_int();
@ -1124,7 +1124,7 @@ static void compilestatements(GenState &gs, int rettype, int brak, int prevargs)
CODE_IVAR1 | (id->get_index() << 8) CODE_IVAR1 | (id->get_index() << 8)
); );
goto endstatement; goto endstatement;
case CsIdentType::fvar: case CsIdentType::Fvar:
more = compilearg(gs, VAL_FLOAT, prevargs); more = compilearg(gs, VAL_FLOAT, prevargs);
if (!more) { if (!more) {
gs.gen_float(); gs.gen_float();
@ -1133,7 +1133,7 @@ static void compilestatements(GenState &gs, int rettype, int brak, int prevargs)
CODE_FVAR1 | (id->get_index() << 8) CODE_FVAR1 | (id->get_index() << 8)
); );
goto endstatement; goto endstatement;
case CsIdentType::svar: case CsIdentType::Svar:
more = compilearg(gs, VAL_CSTR, prevargs); more = compilearg(gs, VAL_CSTR, prevargs);
if (!more) { if (!more) {
gs.gen_str(); gs.gen_str();

134
cs_val.cc
View File

@ -13,10 +13,10 @@ static inline T &csv_get(U &stor) {
template<typename T> template<typename T>
static inline void csv_cleanup(CsValueType tv, T &stor) { static inline void csv_cleanup(CsValueType tv, T &stor) {
switch (tv) { switch (tv) {
case CsValueType::string: case CsValueType::String:
delete[] csv_get<char *>(stor); delete[] csv_get<char *>(stor);
break; break;
case CsValueType::code: { case CsValueType::Code: {
ostd::Uint32 *bcode = csv_get<ostd::Uint32 *>(stor); ostd::Uint32 *bcode = csv_get<ostd::Uint32 *>(stor);
if (bcode[-1] == CODE_START) { if (bcode[-1] == CODE_START) {
delete[] bcode; delete[] bcode;
@ -29,7 +29,7 @@ static inline void csv_cleanup(CsValueType tv, T &stor) {
} }
CsValue::CsValue(): CsValue::CsValue():
p_stor(), p_len(0), p_type(CsValueType::null) p_stor(), p_len(0), p_type(CsValueType::Null)
{} {}
CsValue::~CsValue() { CsValue::~CsValue() {
@ -46,23 +46,23 @@ CsValue::CsValue(CsValue &&v): CsValue() {
CsValue &CsValue::operator=(CsValue const &v) { CsValue &CsValue::operator=(CsValue const &v) {
csv_cleanup(p_type, p_stor); csv_cleanup(p_type, p_stor);
p_type = CsValueType::null; p_type = CsValueType::Null;
switch (v.get_type()) { switch (v.get_type()) {
case CsValueType::integer: case CsValueType::Int:
case CsValueType::number: case CsValueType::Float:
case CsValueType::ident: case CsValueType::Ident:
p_len = v.p_len; p_len = v.p_len;
p_type = v.p_type; p_type = v.p_type;
p_stor = v.p_stor; p_stor = v.p_stor;
break; break;
case CsValueType::string: case CsValueType::String:
case CsValueType::cstring: case CsValueType::Cstring:
case CsValueType::macro: case CsValueType::Macro:
set_str( set_str(
ostd::ConstCharRange(csv_get<char const *>(v.p_stor), v.p_len) ostd::ConstCharRange(csv_get<char const *>(v.p_stor), v.p_len)
); );
break; break;
case CsValueType::code: case CsValueType::Code:
set_code(cs_copy_code(v.get_code())); set_code(cs_copy_code(v.get_code()));
break; break;
default: default:
@ -76,7 +76,7 @@ CsValue &CsValue::operator=(CsValue &&v) {
p_stor = v.p_stor; p_stor = v.p_stor;
p_type = v.p_type; p_type = v.p_type;
p_len = v.p_len; p_len = v.p_len;
v.p_type = CsValueType::null; v.p_type = CsValueType::Null;
return *this; return *this;
} }
@ -86,13 +86,13 @@ CsValueType CsValue::get_type() const {
void CsValue::set_int(CsInt val) { void CsValue::set_int(CsInt val) {
csv_cleanup(p_type, p_stor); csv_cleanup(p_type, p_stor);
p_type = CsValueType::integer; p_type = CsValueType::Int;
csv_get<CsInt>(p_stor) = val; csv_get<CsInt>(p_stor) = val;
} }
void CsValue::set_float(CsFloat val) { void CsValue::set_float(CsFloat val) {
csv_cleanup(p_type, p_stor); csv_cleanup(p_type, p_stor);
p_type = CsValueType::number; p_type = CsValueType::Float;
csv_get<CsFloat>(p_stor) = val; csv_get<CsFloat>(p_stor) = val;
} }
@ -111,44 +111,44 @@ void CsValue::set_str(CsString val) {
void CsValue::set_null() { void CsValue::set_null() {
csv_cleanup(p_type, p_stor); csv_cleanup(p_type, p_stor);
p_type = CsValueType::null; p_type = CsValueType::Null;
} }
void CsValue::set_code(CsBytecode *val) { void CsValue::set_code(CsBytecode *val) {
csv_cleanup(p_type, p_stor); csv_cleanup(p_type, p_stor);
p_type = CsValueType::code; p_type = CsValueType::Code;
csv_get<CsBytecode *>(p_stor) = val; csv_get<CsBytecode *>(p_stor) = val;
} }
void CsValue::set_cstr(ostd::ConstCharRange val) { void CsValue::set_cstr(ostd::ConstCharRange val) {
csv_cleanup(p_type, p_stor); csv_cleanup(p_type, p_stor);
p_type = CsValueType::cstring; p_type = CsValueType::Cstring;
p_len = val.size(); p_len = val.size();
csv_get<char const *>(p_stor) = val.data(); csv_get<char const *>(p_stor) = val.data();
} }
void CsValue::set_mstr(ostd::CharRange val) { void CsValue::set_mstr(ostd::CharRange val) {
csv_cleanup(p_type, p_stor); csv_cleanup(p_type, p_stor);
p_type = CsValueType::string; p_type = CsValueType::String;
p_len = val.size(); p_len = val.size();
csv_get<char *>(p_stor) = val.data(); csv_get<char *>(p_stor) = val.data();
} }
void CsValue::set_ident(CsIdent *val) { void CsValue::set_ident(CsIdent *val) {
csv_cleanup(p_type, p_stor); csv_cleanup(p_type, p_stor);
p_type = CsValueType::ident; p_type = CsValueType::Ident;
csv_get<CsIdent *>(p_stor) = val; csv_get<CsIdent *>(p_stor) = val;
} }
void CsValue::set_macro(ostd::ConstCharRange val) { void CsValue::set_macro(ostd::ConstCharRange val) {
csv_cleanup(p_type, p_stor); csv_cleanup(p_type, p_stor);
p_type = CsValueType::macro; p_type = CsValueType::Macro;
p_len = val.size(); p_len = val.size();
csv_get<char const *>(p_stor) = val.data(); csv_get<char const *>(p_stor) = val.data();
} }
void CsValue::force_null() { void CsValue::force_null() {
if (get_type() == CsValueType::null) { if (get_type() == CsValueType::Null) {
return; return;
} }
set_null(); set_null();
@ -157,17 +157,17 @@ void CsValue::force_null() {
CsFloat CsValue::force_float() { CsFloat CsValue::force_float() {
CsFloat rf = 0.0f; CsFloat rf = 0.0f;
switch (get_type()) { switch (get_type()) {
case CsValueType::integer: case CsValueType::Int:
rf = csv_get<CsInt>(p_stor); rf = csv_get<CsInt>(p_stor);
break; break;
case CsValueType::string: case CsValueType::String:
case CsValueType::macro: case CsValueType::Macro:
case CsValueType::cstring: case CsValueType::Cstring:
rf = cs_parse_float( rf = cs_parse_float(
ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len) ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len)
); );
break; break;
case CsValueType::number: case CsValueType::Float:
return csv_get<CsFloat>(p_stor); return csv_get<CsFloat>(p_stor);
default: default:
break; break;
@ -179,17 +179,17 @@ CsFloat CsValue::force_float() {
CsInt CsValue::force_int() { CsInt CsValue::force_int() {
CsInt ri = 0; CsInt ri = 0;
switch (get_type()) { switch (get_type()) {
case CsValueType::number: case CsValueType::Float:
ri = csv_get<CsFloat>(p_stor); ri = csv_get<CsFloat>(p_stor);
break; break;
case CsValueType::string: case CsValueType::String:
case CsValueType::macro: case CsValueType::Macro:
case CsValueType::cstring: case CsValueType::Cstring:
ri = cs_parse_int( ri = cs_parse_int(
ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len) ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len)
); );
break; break;
case CsValueType::integer: case CsValueType::Int:
return csv_get<CsInt>(p_stor); return csv_get<CsInt>(p_stor);
default: default:
break; break;
@ -201,17 +201,17 @@ CsInt CsValue::force_int() {
ostd::ConstCharRange CsValue::force_str() { ostd::ConstCharRange CsValue::force_str() {
CsString rs; CsString rs;
switch (get_type()) { switch (get_type()) {
case CsValueType::number: case CsValueType::Float:
rs = ostd::move(floatstr(csv_get<CsFloat>(p_stor))); rs = ostd::move(floatstr(csv_get<CsFloat>(p_stor)));
break; break;
case CsValueType::integer: case CsValueType::Int:
rs = ostd::move(intstr(csv_get<CsInt>(p_stor))); rs = ostd::move(intstr(csv_get<CsInt>(p_stor)));
break; break;
case CsValueType::macro: case CsValueType::Macro:
case CsValueType::cstring: case CsValueType::Cstring:
rs = ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len); rs = ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len);
break; break;
case CsValueType::string: case CsValueType::String:
return ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len); return ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len);
default: default:
break; break;
@ -222,13 +222,13 @@ ostd::ConstCharRange CsValue::force_str() {
CsInt CsValue::get_int() const { CsInt CsValue::get_int() const {
switch (get_type()) { switch (get_type()) {
case CsValueType::number: case CsValueType::Float:
return CsInt(csv_get<CsFloat>(p_stor)); return CsInt(csv_get<CsFloat>(p_stor));
case CsValueType::integer: case CsValueType::Int:
return csv_get<CsInt>(p_stor); return csv_get<CsInt>(p_stor);
case CsValueType::string: case CsValueType::String:
case CsValueType::macro: case CsValueType::Macro:
case CsValueType::cstring: case CsValueType::Cstring:
return cs_parse_int( return cs_parse_int(
ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len) ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len)
); );
@ -240,13 +240,13 @@ CsInt CsValue::get_int() const {
CsFloat CsValue::get_float() const { CsFloat CsValue::get_float() const {
switch (get_type()) { switch (get_type()) {
case CsValueType::number: case CsValueType::Float:
return csv_get<CsFloat>(p_stor); return csv_get<CsFloat>(p_stor);
case CsValueType::integer: case CsValueType::Int:
return CsFloat(csv_get<CsInt>(p_stor)); return CsFloat(csv_get<CsInt>(p_stor));
case CsValueType::string: case CsValueType::String:
case CsValueType::macro: case CsValueType::Macro:
case CsValueType::cstring: case CsValueType::Cstring:
return cs_parse_float( return cs_parse_float(
ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len) ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len)
); );
@ -257,14 +257,14 @@ CsFloat CsValue::get_float() const {
} }
CsBytecode *CsValue::get_code() const { CsBytecode *CsValue::get_code() const {
if (get_type() != CsValueType::code) { if (get_type() != CsValueType::Code) {
return nullptr; return nullptr;
} }
return csv_get<CsBytecode *>(p_stor); return csv_get<CsBytecode *>(p_stor);
} }
CsIdent *CsValue::get_ident() const { CsIdent *CsValue::get_ident() const {
if (get_type() != CsValueType::ident) { if (get_type() != CsValueType::Ident) {
return nullptr; return nullptr;
} }
return csv_get<CsIdent *>(p_stor); return csv_get<CsIdent *>(p_stor);
@ -272,13 +272,13 @@ CsIdent *CsValue::get_ident() const {
CsString CsValue::get_str() const { CsString CsValue::get_str() const {
switch (get_type()) { switch (get_type()) {
case CsValueType::string: case CsValueType::String:
case CsValueType::macro: case CsValueType::Macro:
case CsValueType::cstring: case CsValueType::Cstring:
return ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len); return ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len);
case CsValueType::integer: case CsValueType::Int:
return intstr(csv_get<CsInt>(p_stor)); return intstr(csv_get<CsInt>(p_stor));
case CsValueType::number: case CsValueType::Float:
return floatstr(csv_get<CsFloat>(p_stor)); return floatstr(csv_get<CsFloat>(p_stor));
default: default:
break; break;
@ -288,9 +288,9 @@ CsString CsValue::get_str() const {
ostd::ConstCharRange CsValue::get_strr() const { ostd::ConstCharRange CsValue::get_strr() const {
switch (get_type()) { switch (get_type()) {
case CsValueType::string: case CsValueType::String:
case CsValueType::macro: case CsValueType::Macro:
case CsValueType::cstring: case CsValueType::Cstring:
return ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len); return ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len);
default: default:
break; break;
@ -300,17 +300,17 @@ ostd::ConstCharRange CsValue::get_strr() const {
void CsValue::get_val(CsValue &r) const { void CsValue::get_val(CsValue &r) const {
switch (get_type()) { switch (get_type()) {
case CsValueType::string: case CsValueType::String:
case CsValueType::macro: case CsValueType::Macro:
case CsValueType::cstring: case CsValueType::Cstring:
r.set_str( r.set_str(
ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len) ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len)
); );
break; break;
case CsValueType::integer: case CsValueType::Int:
r.set_int(csv_get<CsInt>(p_stor)); r.set_int(csv_get<CsInt>(p_stor));
break; break;
case CsValueType::number: case CsValueType::Float:
r.set_float(csv_get<CsFloat>(p_stor)); r.set_float(csv_get<CsFloat>(p_stor));
break; break;
default: default:
@ -329,7 +329,7 @@ OSTD_EXPORT bool cs_code_is_empty(CsBytecode *code) {
} }
bool CsValue::code_is_empty() const { bool CsValue::code_is_empty() const {
if (get_type() != CsValueType::code) { if (get_type() != CsValueType::Code) {
return true; return true;
} }
return cscript::cs_code_is_empty(csv_get<CsBytecode *>(p_stor)); return cscript::cs_code_is_empty(csv_get<CsBytecode *>(p_stor));
@ -354,13 +354,13 @@ static inline bool cs_get_bool(ostd::ConstCharRange s) {
bool CsValue::get_bool() const { bool CsValue::get_bool() const {
switch (get_type()) { switch (get_type()) {
case CsValueType::number: case CsValueType::Float:
return csv_get<CsFloat>(p_stor) != 0; return csv_get<CsFloat>(p_stor) != 0;
case CsValueType::integer: case CsValueType::Int:
return csv_get<CsInt>(p_stor) != 0; return csv_get<CsInt>(p_stor) != 0;
case CsValueType::string: case CsValueType::String:
case CsValueType::macro: case CsValueType::Macro:
case CsValueType::cstring: case CsValueType::Cstring:
return cs_get_bool( return cs_get_bool(
ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len) ostd::ConstCharRange(csv_get<char const *>(p_stor), p_len)
); );

View File

@ -169,9 +169,9 @@ static inline ostd::Uint32 *forcecode(CsState &cs, CsValue &v) {
static inline void forcecond(CsState &cs, CsValue &v) { static inline void forcecond(CsState &cs, CsValue &v) {
switch (v.get_type()) { switch (v.get_type()) {
case CsValueType::string: case CsValueType::String:
case CsValueType::macro: case CsValueType::Macro:
case CsValueType::cstring: case CsValueType::Cstring:
if (!v.get_strr().empty()) { if (!v.get_strr().empty()) {
forcecode(cs, v); forcecode(cs, v);
} else { } else {
@ -193,17 +193,17 @@ static ostd::Uint32 emptyblock[VAL_ANY][2] = {
static inline void force_arg(CsValue &v, int type) { static inline void force_arg(CsValue &v, int type) {
switch (type) { switch (type) {
case RET_STR: case RET_STR:
if (v.get_type() != CsValueType::string) { if (v.get_type() != CsValueType::String) {
v.force_str(); v.force_str();
} }
break; break;
case RET_INT: case RET_INT:
if (v.get_type() != CsValueType::integer) { if (v.get_type() != CsValueType::Int) {
v.force_int(); v.force_int();
} }
break; break;
case RET_FLOAT: case RET_FLOAT:
if (v.get_type() != CsValueType::number) { if (v.get_type() != CsValueType::Float) {
v.force_float(); v.force_float();
} }
break; break;
@ -487,16 +487,16 @@ static inline int cs_get_lookupu_type(
CsState &cs, CsValue &arg, CsIdent *&id, ostd::Uint32 op CsState &cs, CsValue &arg, CsIdent *&id, ostd::Uint32 op
) { ) {
if ( if (
arg.get_type() != CsValueType::string && arg.get_type() != CsValueType::String &&
arg.get_type() != CsValueType::macro && arg.get_type() != CsValueType::Macro &&
arg.get_type() != CsValueType::cstring arg.get_type() != CsValueType::Cstring
) { ) {
return -2; /* default case */ return -2; /* default case */
} }
id = cs.get_ident(arg.get_strr()); id = cs.get_ident(arg.get_strr());
if (id) { if (id) {
switch(id->get_type()) { switch(id->get_type()) {
case CsIdentType::alias: case CsIdentType::Alias:
if (id->get_flags() & IDF_UNKNOWN) { if (id->get_flags() & IDF_UNKNOWN) {
break; break;
} }
@ -507,13 +507,13 @@ static inline int cs_get_lookupu_type(
return ID_UNKNOWN; return ID_UNKNOWN;
} }
return ID_ALIAS; return ID_ALIAS;
case CsIdentType::svar: case CsIdentType::Svar:
return ID_SVAR; return ID_SVAR;
case CsIdentType::ivar: case CsIdentType::Ivar:
return ID_IVAR; return ID_IVAR;
case CsIdentType::fvar: case CsIdentType::Fvar:
return ID_FVAR; return ID_FVAR;
case CsIdentType::command: { case CsIdentType::Command: {
arg.set_null(); arg.set_null();
CsValue buf[MaxArguments]; CsValue buf[MaxArguments];
callcommand(cs, static_cast<CsCommand *>(id), buf, arg, 0, true); callcommand(cs, static_cast<CsCommand *>(id), buf, arg, 0, true);
@ -680,7 +680,7 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
case CODE_JUMP_RESULT_TRUE: { case CODE_JUMP_RESULT_TRUE: {
ostd::Uint32 len = op >> 8; ostd::Uint32 len = op >> 8;
--numargs; --numargs;
if (args[numargs].get_type() == CsValueType::code) { if (args[numargs].get_type() == CsValueType::Code) {
cs.run(args[numargs].get_code(), result); cs.run(args[numargs].get_code(), result);
} else { } else {
result = ostd::move(args[numargs]); result = ostd::move(args[numargs]);
@ -693,7 +693,7 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
case CODE_JUMP_RESULT_FALSE: { case CODE_JUMP_RESULT_FALSE: {
ostd::Uint32 len = op >> 8; ostd::Uint32 len = op >> 8;
--numargs; --numargs;
if (args[numargs].get_type() == CsValueType::code) { if (args[numargs].get_type() == CsValueType::Code) {
cs.run(args[numargs].get_code(), result); cs.run(args[numargs].get_code(), result);
} else { } else {
result = ostd::move(args[numargs]); result = ostd::move(args[numargs]);
@ -818,23 +818,23 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
CsValue &arg = args[numargs - 1]; CsValue &arg = args[numargs - 1];
GenState gs(cs); GenState gs(cs);
switch (arg.get_type()) { switch (arg.get_type()) {
case CsValueType::integer: case CsValueType::Int:
gs.code.reserve(8); gs.code.reserve(8);
gs.code.push(CODE_START); gs.code.push(CODE_START);
gs.gen_int(arg.get_int()); gs.gen_int(arg.get_int());
gs.code.push(CODE_RESULT); gs.code.push(CODE_RESULT);
gs.code.push(CODE_EXIT); gs.code.push(CODE_EXIT);
break; break;
case CsValueType::number: case CsValueType::Float:
gs.code.reserve(8); gs.code.reserve(8);
gs.code.push(CODE_START); gs.code.push(CODE_START);
gs.gen_float(arg.get_float()); gs.gen_float(arg.get_float());
gs.code.push(CODE_RESULT); gs.code.push(CODE_RESULT);
gs.code.push(CODE_EXIT); gs.code.push(CODE_EXIT);
break; break;
case CsValueType::string: case CsValueType::String:
case CsValueType::macro: case CsValueType::Macro:
case CsValueType::cstring: case CsValueType::Cstring:
gs.code.reserve(64); gs.code.reserve(64);
gs.gen_main(arg.get_strr()); gs.gen_main(arg.get_strr());
break; break;
@ -854,9 +854,9 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
case CODE_COND: { case CODE_COND: {
CsValue &arg = args[numargs - 1]; CsValue &arg = args[numargs - 1];
switch (arg.get_type()) { switch (arg.get_type()) {
case CsValueType::string: case CsValueType::String:
case CsValueType::macro: case CsValueType::Macro:
case CsValueType::cstring: { case CsValueType::Cstring: {
ostd::ConstCharRange s = arg.get_strr(); ostd::ConstCharRange s = arg.get_strr();
if (!s.empty()) { if (!s.empty()) {
GenState gs(cs); GenState gs(cs);
@ -895,9 +895,9 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
CsValue &arg = args[numargs - 1]; CsValue &arg = args[numargs - 1];
CsIdent *id = cs.identmap[DummyIdx]; CsIdent *id = cs.identmap[DummyIdx];
if ( if (
arg.get_type() == CsValueType::string || arg.get_type() == CsValueType::String ||
arg.get_type() == CsValueType::macro || arg.get_type() == CsValueType::Macro ||
arg.get_type() == CsValueType::cstring arg.get_type() == CsValueType::Cstring
) { ) {
id = cs.new_ident(arg.get_strr()); id = cs.new_ident(arg.get_strr());
} }
@ -1402,9 +1402,9 @@ static ostd::Uint32 *runcode(CsState &cs, ostd::Uint32 *code, CsValue &result) {
int callargs = op >> 8, offset = numargs - callargs; int callargs = op >> 8, offset = numargs - callargs;
CsValue &idarg = args[offset - 1]; CsValue &idarg = args[offset - 1];
if ( if (
idarg.get_type() != CsValueType::string && idarg.get_type() != CsValueType::String &&
idarg.get_type() != CsValueType::macro && idarg.get_type() != CsValueType::Macro &&
idarg.get_type() != CsValueType::cstring idarg.get_type() != CsValueType::Cstring
) { ) {
litval: litval:
result = ostd::move(idarg); result = ostd::move(idarg);
@ -1500,7 +1500,7 @@ noid:
force_arg(result, op & CODE_RET_MASK); force_arg(result, op & CODE_RET_MASK);
continue; continue;
} }
if (a->get_value().get_type() == CsValueType::null) { if (a->get_value().get_type() == CsValueType::Null) {
goto noid; goto noid;
} }
cs_call_alias( cs_call_alias(
@ -1546,7 +1546,7 @@ void CsState::run(CsIdent *id, CsValueRange args, CsValue &ret) {
break; break;
} }
/* fallthrough */ /* fallthrough */
case CsIdentType::command: case CsIdentType::Command:
if (nargs < static_cast<CsCommand *>(id)->get_num_args()) { if (nargs < static_cast<CsCommand *>(id)->get_num_args()) {
CsValue buf[MaxArguments]; CsValue buf[MaxArguments];
memcpy(buf, args.data(), args.size() * sizeof(CsValue)); memcpy(buf, args.data(), args.size() * sizeof(CsValue));
@ -1562,14 +1562,14 @@ void CsState::run(CsIdent *id, CsValueRange args, CsValue &ret) {
} }
nargs = 0; nargs = 0;
break; break;
case CsIdentType::ivar: case CsIdentType::Ivar:
if (args.empty()) { if (args.empty()) {
print_var(static_cast<CsIvar *>(id)); print_var(static_cast<CsIvar *>(id));
} else { } else {
set_var_int_checked(static_cast<CsIvar *>(id), args); set_var_int_checked(static_cast<CsIvar *>(id), args);
} }
break; break;
case CsIdentType::fvar: case CsIdentType::Fvar:
if (args.empty()) { if (args.empty()) {
print_var(static_cast<CsFvar *>(id)); print_var(static_cast<CsFvar *>(id));
} else { } else {
@ -1578,7 +1578,7 @@ void CsState::run(CsIdent *id, CsValueRange args, CsValue &ret) {
); );
} }
break; break;
case CsIdentType::svar: case CsIdentType::Svar:
if (args.empty()) { if (args.empty()) {
print_var(static_cast<CsSvar *>(id)); print_var(static_cast<CsSvar *>(id));
} else { } else {
@ -1587,14 +1587,14 @@ void CsState::run(CsIdent *id, CsValueRange args, CsValue &ret) {
); );
} }
break; break;
case CsIdentType::alias: { case CsIdentType::Alias: {
CsAlias *a = static_cast<CsAlias *>(id); CsAlias *a = static_cast<CsAlias *>(id);
if (a->get_index() < MaxArguments) { if (a->get_index() < MaxArguments) {
if (!(p_stack->usedargs & (1 << a->get_index()))) { if (!(p_stack->usedargs & (1 << a->get_index()))) {
break; break;
} }
} }
if (a->get_value().get_type() == CsValueType::null) { if (a->get_value().get_type() == CsValueType::Null) {
break; break;
} }
cs_call_alias( cs_call_alias(

View File

@ -41,48 +41,48 @@ CsVar::CsVar(CsIdentType tp, ostd::ConstCharRange name, CsVarCb f, int fl):
CsIvar::CsIvar( CsIvar::CsIvar(
ostd::ConstCharRange name, CsInt m, CsInt x, CsInt v, CsVarCb f, int fl ostd::ConstCharRange name, CsInt m, CsInt x, CsInt v, CsVarCb f, int fl
): ):
CsVar(CsIdentType::ivar, name, ostd::move(f), fl | ((m > x) ? IDF_READONLY : 0)), CsVar(CsIdentType::Ivar, name, ostd::move(f), fl | ((m > x) ? IDF_READONLY : 0)),
p_storage(v), p_minval(m), p_maxval(x), p_overrideval(0) p_storage(v), p_minval(m), p_maxval(x), p_overrideval(0)
{} {}
CsFvar::CsFvar( CsFvar::CsFvar(
ostd::ConstCharRange name, CsFloat m, CsFloat x, CsFloat v, CsVarCb f, int fl ostd::ConstCharRange name, CsFloat m, CsFloat x, CsFloat v, CsVarCb f, int fl
): ):
CsVar(CsIdentType::fvar, name, ostd::move(f), fl | ((m > x) ? IDF_READONLY : 0)), CsVar(CsIdentType::Fvar, name, ostd::move(f), fl | ((m > x) ? IDF_READONLY : 0)),
p_storage(v), p_minval(m), p_maxval(x), p_overrideval(0) p_storage(v), p_minval(m), p_maxval(x), p_overrideval(0)
{} {}
CsSvar::CsSvar(ostd::ConstCharRange name, CsString v, CsVarCb f, int fl): CsSvar::CsSvar(ostd::ConstCharRange name, CsString v, CsVarCb f, int fl):
CsVar(CsIdentType::svar, name, ostd::move(f), fl), CsVar(CsIdentType::Svar, name, ostd::move(f), fl),
p_storage(ostd::move(v)), p_overrideval() p_storage(ostd::move(v)), p_overrideval()
{} {}
CsAlias::CsAlias(ostd::ConstCharRange name, char *a, int fl): CsAlias::CsAlias(ostd::ConstCharRange name, char *a, int fl):
CsIdent(CsIdentType::alias, name, fl), CsIdent(CsIdentType::Alias, name, fl),
p_acode(nullptr), p_astack(nullptr) p_acode(nullptr), p_astack(nullptr)
{ {
p_val.set_mstr(a); p_val.set_mstr(a);
} }
CsAlias::CsAlias(ostd::ConstCharRange name, CsInt a, int fl): CsAlias::CsAlias(ostd::ConstCharRange name, CsInt a, int fl):
CsIdent(CsIdentType::alias, name, fl), CsIdent(CsIdentType::Alias, name, fl),
p_acode(nullptr), p_astack(nullptr) p_acode(nullptr), p_astack(nullptr)
{ {
p_val.set_int(a); p_val.set_int(a);
} }
CsAlias::CsAlias(ostd::ConstCharRange name, CsFloat a, int fl): CsAlias::CsAlias(ostd::ConstCharRange name, CsFloat a, int fl):
CsIdent(CsIdentType::alias, name, fl), CsIdent(CsIdentType::Alias, name, fl),
p_acode(nullptr), p_astack(nullptr) p_acode(nullptr), p_astack(nullptr)
{ {
p_val.set_float(a); p_val.set_float(a);
} }
CsAlias::CsAlias(ostd::ConstCharRange name, int fl): CsAlias::CsAlias(ostd::ConstCharRange name, int fl):
CsIdent(CsIdentType::alias, name, fl), CsIdent(CsIdentType::Alias, name, fl),
p_acode(nullptr), p_astack(nullptr) p_acode(nullptr), p_astack(nullptr)
{ {
p_val.set_null(); p_val.set_null();
} }
CsAlias::CsAlias(ostd::ConstCharRange name, CsValue v, int fl): CsAlias::CsAlias(ostd::ConstCharRange name, CsValue v, int fl):
CsIdent(CsIdentType::alias, name, 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(ostd::move(v))
{} {}
@ -90,12 +90,12 @@ CsCommand::CsCommand(
ostd::ConstCharRange name, ostd::ConstCharRange args, ostd::ConstCharRange name, ostd::ConstCharRange args,
int nargs, CsCommandCb f int nargs, CsCommandCb f
): ):
CsIdent(CsIdentType::command, name, 0), CsIdent(CsIdentType::Command, name, 0),
p_cargs(args), p_cb_cftv(ostd::move(f)), p_numargs(nargs) p_cargs(args), p_cb_cftv(ostd::move(f)), p_numargs(nargs)
{} {}
bool CsIdent::is_alias() const { bool CsIdent::is_alias() const {
return get_type() == CsIdentType::alias; return get_type() == CsIdentType::Alias;
} }
CsAlias *CsIdent::get_alias() { CsAlias *CsIdent::get_alias() {
@ -113,7 +113,7 @@ CsAlias const *CsIdent::get_alias() const {
} }
bool CsIdent::is_command() const { bool CsIdent::is_command() const {
return get_type() == CsIdentType::command; return get_type() == CsIdentType::Command;
} }
CsCommand *CsIdent::get_command() { CsCommand *CsIdent::get_command() {
@ -131,12 +131,12 @@ CsCommand const *CsIdent::get_command() const {
} }
bool CsIdent::is_special() const { bool CsIdent::is_special() const {
return get_type() == CsIdentType::special; return get_type() == CsIdentType::Special;
} }
bool CsIdent::is_var() const { bool CsIdent::is_var() const {
CsIdentType tp = get_type(); CsIdentType tp = get_type();
return (tp >= CsIdentType::ivar) && (tp <= CsIdentType::svar); return (tp >= CsIdentType::Ivar) && (tp <= CsIdentType::Svar);
} }
CsVar *CsIdent::get_var() { CsVar *CsIdent::get_var() {
@ -154,7 +154,7 @@ CsVar const *CsIdent::get_var() const {
} }
bool CsIdent::is_ivar() const { bool CsIdent::is_ivar() const {
return get_type() == CsIdentType::ivar; return get_type() == CsIdentType::Ivar;
} }
CsIvar *CsIdent::get_ivar() { CsIvar *CsIdent::get_ivar() {
@ -172,7 +172,7 @@ CsIvar const *CsIdent::get_ivar() const {
} }
bool CsIdent::is_fvar() const { bool CsIdent::is_fvar() const {
return get_type() == CsIdentType::fvar; return get_type() == CsIdentType::Fvar;
} }
CsFvar *CsIdent::get_fvar() { CsFvar *CsIdent::get_fvar() {
@ -190,7 +190,7 @@ CsFvar const *CsIdent::get_fvar() const {
} }
bool CsIdent::is_svar() const { bool CsIdent::is_svar() const {
return get_type() == CsIdentType::svar; return get_type() == CsIdentType::Svar;
} }
CsSvar *CsIdent::get_svar() { CsSvar *CsIdent::get_svar() {
@ -399,25 +399,25 @@ void CsState::clear_override(CsIdent &id) {
return; return;
} }
switch (id.get_type()) { switch (id.get_type()) {
case CsIdentType::alias: { case CsIdentType::Alias: {
CsAlias &a = static_cast<CsAlias &>(id); CsAlias &a = static_cast<CsAlias &>(id);
CsAliasInternal::clean_code(&a); CsAliasInternal::clean_code(&a);
a.get_value().set_str(""); a.get_value().set_str("");
break; break;
} }
case CsIdentType::ivar: { case CsIdentType::Ivar: {
CsIvar &iv = static_cast<CsIvar &>(id); CsIvar &iv = static_cast<CsIvar &>(id);
iv.set_value(iv.p_overrideval); iv.set_value(iv.p_overrideval);
iv.changed(); iv.changed();
break; break;
} }
case CsIdentType::fvar: { case CsIdentType::Fvar: {
CsFvar &fv = static_cast<CsFvar &>(id); CsFvar &fv = static_cast<CsFvar &>(id);
fv.set_value(fv.p_overrideval); fv.set_value(fv.p_overrideval);
fv.changed(); fv.changed();
break; break;
} }
case CsIdentType::svar: { case CsIdentType::Svar: {
CsSvar &sv = static_cast<CsSvar &>(id); CsSvar &sv = static_cast<CsSvar &>(id);
sv.set_value(sv.p_overrideval); sv.set_value(sv.p_overrideval);
sv.changed(); sv.changed();
@ -460,11 +460,11 @@ CsIdent *CsState::new_ident(ostd::ConstCharRange name, int flags) {
CsIdent *CsState::force_ident(CsValue &v) { CsIdent *CsState::force_ident(CsValue &v) {
switch (v.get_type()) { switch (v.get_type()) {
case CsValueType::ident: case CsValueType::Ident:
return v.get_ident(); return v.get_ident();
case CsValueType::macro: case CsValueType::Macro:
case CsValueType::cstring: case CsValueType::Cstring:
case CsValueType::string: { case CsValueType::String: {
CsIdent *id = new_ident(v.get_strr()); CsIdent *id = new_ident(v.get_strr());
v.set_ident(id); v.set_ident(id);
return id; return id;
@ -520,7 +520,7 @@ void CsState::set_alias(ostd::ConstCharRange name, CsValue v) {
CsIdent *id = get_ident(name); CsIdent *id = get_ident(name);
if (id) { if (id) {
switch (id->get_type()) { switch (id->get_type()) {
case CsIdentType::alias: { case CsIdentType::Alias: {
CsAlias *a = static_cast<CsAlias *>(id); CsAlias *a = static_cast<CsAlias *>(id);
if (a->get_index() < MaxArguments) { if (a->get_index() < MaxArguments) {
CsAliasInternal::set_arg(a, *this, v); CsAliasInternal::set_arg(a, *this, v);
@ -529,13 +529,13 @@ void CsState::set_alias(ostd::ConstCharRange name, CsValue v) {
} }
return; return;
} }
case CsIdentType::ivar: case CsIdentType::Ivar:
set_var_int_checked(static_cast<CsIvar *>(id), v.get_int()); set_var_int_checked(static_cast<CsIvar *>(id), v.get_int());
break; break;
case CsIdentType::fvar: case CsIdentType::Fvar:
set_var_float_checked(static_cast<CsFvar *>(id), v.get_float()); set_var_float_checked(static_cast<CsFvar *>(id), v.get_float());
break; break;
case CsIdentType::svar: case CsIdentType::Svar:
set_var_str_checked(static_cast<CsSvar *>(id), v.get_str()); set_var_str_checked(static_cast<CsSvar *>(id), v.get_str());
break; break;
default: default:
@ -587,17 +587,17 @@ void CsState::print_var(CsSvar *sv) {
void CsState::print_var(CsVar *v) { void CsState::print_var(CsVar *v) {
switch (v->get_type()) { switch (v->get_type()) {
case CsIdentType::ivar: { case CsIdentType::Ivar: {
CsIvar *iv = static_cast<CsIvar *>(v); CsIvar *iv = static_cast<CsIvar *>(v);
print_var(iv); print_var(iv);
break; break;
} }
case CsIdentType::fvar: { case CsIdentType::Fvar: {
CsFvar *fv = static_cast<CsFvar *>(v); CsFvar *fv = static_cast<CsFvar *>(v);
print_var(fv); print_var(fv);
break; break;
} }
case CsIdentType::svar: { case CsIdentType::Svar: {
CsSvar *sv = static_cast<CsSvar *>(v); CsSvar *sv = static_cast<CsSvar *>(v);
print_var(sv); print_var(sv);
break; break;
@ -609,17 +609,17 @@ void CsState::print_var(CsVar *v) {
void CsAlias::get_cstr(CsValue &v) const { void CsAlias::get_cstr(CsValue &v) const {
switch (p_val.get_type()) { switch (p_val.get_type()) {
case CsValueType::macro: case CsValueType::Macro:
v.set_macro(p_val.get_strr()); v.set_macro(p_val.get_strr());
break; break;
case CsValueType::string: case CsValueType::String:
case CsValueType::cstring: case CsValueType::Cstring:
v.set_cstr(p_val.get_strr()); v.set_cstr(p_val.get_strr());
break; break;
case CsValueType::integer: case CsValueType::Int:
v.set_str(ostd::move(intstr(p_val.get_int()))); v.set_str(ostd::move(intstr(p_val.get_int())));
break; break;
case CsValueType::number: case CsValueType::Float:
v.set_str(ostd::move(floatstr(p_val.get_float()))); v.set_str(ostd::move(floatstr(p_val.get_float())));
break; break;
default: default:
@ -630,17 +630,17 @@ void CsAlias::get_cstr(CsValue &v) const {
void CsAlias::get_cval(CsValue &v) const { void CsAlias::get_cval(CsValue &v) const {
switch (p_val.get_type()) { switch (p_val.get_type()) {
case CsValueType::macro: case CsValueType::Macro:
v.set_macro(p_val.get_strr()); v.set_macro(p_val.get_strr());
break; break;
case CsValueType::string: case CsValueType::String:
case CsValueType::cstring: case CsValueType::Cstring:
v.set_cstr(p_val.get_strr()); v.set_cstr(p_val.get_strr());
break; break;
case CsValueType::integer: case CsValueType::Int:
v.set_int(p_val.get_int()); v.set_int(p_val.get_int());
break; break;
case CsValueType::number: case CsValueType::Float:
v.set_float(p_val.get_float()); v.set_float(p_val.get_float());
break; break;
default: default:
@ -651,7 +651,7 @@ void CsAlias::get_cval(CsValue &v) const {
CsIdentType CsIdent::get_type() const { CsIdentType CsIdent::get_type() const {
if (p_type > ID_ALIAS) { if (p_type > ID_ALIAS) {
return CsIdentType::special; return CsIdentType::Special;
} }
return CsIdentType(p_type); return CsIdentType(p_type);
} }
@ -1055,7 +1055,7 @@ void cs_init_lib_base(CsState &cs) {
CsInt val = args[0].get_int(); CsInt val = args[0].get_int();
for (ostd::Size i = 1; (i + 1) < args.size(); i += 2) { for (ostd::Size i = 1; (i + 1) < args.size(); i += 2) {
if ( if (
(args[i].get_type() == CsValueType::null) || (args[i].get_type() == CsValueType::Null) ||
(args[i].get_int() == val) (args[i].get_int() == val)
) { ) {
cs.run(args[i + 1].get_code(), res); cs.run(args[i + 1].get_code(), res);
@ -1068,7 +1068,7 @@ void cs_init_lib_base(CsState &cs) {
CsFloat val = args[0].get_float(); CsFloat val = args[0].get_float();
for (ostd::Size i = 1; (i + 1) < args.size(); i += 2) { for (ostd::Size i = 1; (i + 1) < args.size(); i += 2) {
if ( if (
(args[i].get_type() == CsValueType::null) || (args[i].get_type() == CsValueType::Null) ||
(args[i].get_float() == val) (args[i].get_float() == val)
) { ) {
cs.run(args[i + 1].get_code(), res); cs.run(args[i + 1].get_code(), res);
@ -1081,7 +1081,7 @@ void cs_init_lib_base(CsState &cs) {
CsString val = args[0].get_str(); CsString val = args[0].get_str();
for (ostd::Size i = 1; (i + 1) < args.size(); i += 2) { for (ostd::Size i = 1; (i + 1) < args.size(); i += 2) {
if ( if (
(args[i].get_type() == CsValueType::null) || (args[i].get_type() == CsValueType::Null) ||
(args[i].get_str() == val) (args[i].get_str() == val)
) { ) {
cs.run(args[i + 1].get_code(), res); cs.run(args[i + 1].get_code(), res);

View File

@ -61,7 +61,7 @@ OSTD_EXPORT bool cs_code_is_empty(CsBytecode *code);
struct CsIdent; struct CsIdent;
enum class CsValueType { enum class CsValueType {
null = 0, integer, number, string, cstring, code, macro, ident Null = 0, Int, Float, String, Cstring, Code, Macro, Ident
}; };
struct OSTD_EXPORT CsValue { struct OSTD_EXPORT CsValue {
@ -119,7 +119,7 @@ struct CsIdentStack {
struct CsState; struct CsState;
enum class CsIdentType { enum class CsIdentType {
ivar = 0, fvar, svar, command, alias, special Ivar = 0, Fvar, Svar, Command, Alias, Special
}; };
struct CsVar; struct CsVar;
@ -603,7 +603,7 @@ namespace util {
for (ostd::Size i = 0; i < vals.size(); ++i) { for (ostd::Size i = 0; i < vals.size(); ++i) {
auto s = ostd::appender<CsString>(); auto s = ostd::appender<CsString>();
switch (vals[i].get_type()) { switch (vals[i].get_type()) {
case CsValueType::integer: { case CsValueType::Int: {
auto r = format_int( auto r = format_int(
ostd::forward<R>(writer), vals[i].get_int() ostd::forward<R>(writer), vals[i].get_int()
); );
@ -612,7 +612,7 @@ namespace util {
} }
break; break;
} }
case CsValueType::number: { case CsValueType::Float: {
auto r = format_float( auto r = format_float(
ostd::forward<R>(writer), vals[i].get_float() ostd::forward<R>(writer), vals[i].get_float()
); );
@ -621,9 +621,9 @@ namespace util {
} }
break; break;
} }
case CsValueType::string: case CsValueType::String:
case CsValueType::cstring: case CsValueType::Cstring:
case CsValueType::macro: { case CsValueType::Macro: {
auto sv = vals[i].get_strr(); auto sv = vals[i].get_strr();
ret += writer.put_n(sv.data(), sv.size()); ret += writer.put_n(sv.data(), sv.size());
break; break;

View File

@ -189,7 +189,7 @@ static void do_call(CsState &cs, ostd::ConstCharRange line) {
return; return;
} }
signal(SIGINT, SIG_DFL); signal(SIGINT, SIG_DFL);
if (ret.get_type() != CsValueType::null) { if (ret.get_type() != CsValueType::Null) {
ostd::writeln(ret.get_str()); ostd::writeln(ret.get_str());
} }
} }