mirror of
https://github.com/louisrubet/rpn
synced 2025-01-01 18:20:06 +01:00
->str and str->
This commit is contained in:
parent
9197d5d36d
commit
73f2578a12
1 changed files with 5 additions and 10 deletions
|
@ -2,8 +2,6 @@ void instr()
|
|||
{
|
||||
MIN_ARGUMENTS(1);
|
||||
|
||||
//TODO
|
||||
#if 0
|
||||
// stringify only if not already a string
|
||||
if (_stack->get_type(0) != cmd_string)
|
||||
{
|
||||
|
@ -11,29 +9,26 @@ void instr()
|
|||
((object*)_stack->back())->show(out);
|
||||
_stack->pop_back();
|
||||
|
||||
ostring* str = new ostring(out.str().c_str());
|
||||
_stack->push_back(str, sizeof(ostring), cmd_string);
|
||||
ostring str;
|
||||
str.set(out.str().c_str(), out.str().size());
|
||||
_stack->push_back(&str, str.size(), cmd_string);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void strout()
|
||||
{
|
||||
//TODO
|
||||
#if 0
|
||||
MIN_ARGUMENTS(1);
|
||||
ARG_MUST_BE_OF_TYPE(0, cmd_string);
|
||||
|
||||
string& entry = *((ostring*)_stack->back())->_value;
|
||||
string entry(((ostring*)_stack->back())->_value);
|
||||
_stack->pop_back();
|
||||
|
||||
program prog;
|
||||
|
||||
// make program from string in stack level 1
|
||||
if (program::parse(entry, prog) == ret_ok)
|
||||
if (program::parse(entry.c_str(), prog) == ret_ok)
|
||||
{
|
||||
// run it
|
||||
prog.run(*_stack, *_heap);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue