string management

This commit is contained in:
Louis 2015-02-11 18:18:51 +01:00
parent 42108eb02e
commit 9c1a6eea57
3 changed files with 14 additions and 0 deletions

View file

@ -16,6 +16,14 @@ void plus()
//TODO really too slow
putb(getb() + getb());
}
// string
else if (IS_ARG_TYPE(0, cmd_string))
{
ARG_MUST_BE_OF_TYPE(1, cmd_string);
string& second = *((ostring*)_stack->back())->_name;
_stack->pop_back();
*((ostring*)_stack->back())->_name += second;
}
}
void minus()

View file

@ -66,6 +66,11 @@ program::keyword_t program::_keywords[] =
{ cmd_keyword, "pick", &program::pick, "push a copy of the given stack level onto the stack" },
{ cmd_keyword, "depth", &program::depth, "give stack depth" },
//STRING
{ cmd_undef, "", NULL, "\nSTRING"},
{ cmd_keyword, "->str", &program::instr, "convert an object into a string" },
{ cmd_keyword, "str->", &program::strout, "convert a string into an object" },
//BRANCH
{ cmd_undef, "", NULL, "\nBRANCH"},
{ cmd_branch, "if", (program_fn_t)&program::rpn_if, "<test-instructions>" },

View file

@ -651,6 +651,7 @@ private:
#include "rpn-binary.h"
#include "rpn-test.h"
#include "rpn-stack.h"
#include "rpn-string.h"
#include "rpn-branch.h"
#include "rpn-store.h"
#include "rpn-trig.h"