mirror of
https://github.com/louisrubet/rpn
synced 2025-01-01 18:20:06 +01:00
string management
This commit is contained in:
parent
42108eb02e
commit
9c1a6eea57
3 changed files with 14 additions and 0 deletions
|
@ -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()
|
||||
|
|
|
@ -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>" },
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue