rcl and eval do not eat unknown variables anymore

This commit is contained in:
Louis 2015-02-24 16:50:01 +01:00
parent f1df23ef61
commit 995e8f8b15
2 changed files with 12 additions and 2 deletions

View file

@ -8,13 +8,18 @@ void eval(void)
void* obj;
unsigned int size;
int type;
if (_heap->get(getn(), obj, size, type))
string& variable = *((symbol*)_stack->back())->_value;
if (_heap->get(variable, obj, size, type))
{
_stack->pop_back();
_stack->push_back(obj, size, type);
}
else
ERR_CONTEXT(ret_unknown_variable);
}
else if (IS_ARG_TYPE(0, cmd_program))
{
// eval a program
string& entry = *((oprogram*)_stack->back())->_value;
_stack->pop_back();

View file

@ -14,11 +14,16 @@ void rcl(void)
MIN_ARGUMENTS(1);
ARG_MUST_BE_OF_TYPE(0, cmd_symbol);
// recall a variable
void* obj;
unsigned int size;
int type;
if (_heap->get(getn(), obj, size, type))
string& variable = *((symbol*)_stack->back())->_value;
if (_heap->get(variable, obj, size, type))
{
_stack->pop_back();
_stack->push_back(obj, size, type);
}
else
ERR_CONTEXT(ret_unknown_variable);
}