mirror of
https://github.com/louisrubet/rpn
synced 2025-01-16 03:41:28 +01:00
#49: debug autoeval issue
This commit is contained in:
parent
fdb7c8bff8
commit
fc4b4dfcd5
3 changed files with 10 additions and 8 deletions
12
src/parse.h
12
src/parse.h
|
@ -213,9 +213,9 @@ static bool get_symbol(const string& entry, program& prog, string& remaining_ent
|
||||||
obj_len = sizeof(symbol)+1;
|
obj_len = sizeof(symbol)+1;
|
||||||
|
|
||||||
// allocate and set object
|
// allocate and set object
|
||||||
|
// symbol beginning with ' is not autoevaluated
|
||||||
symbol* new_obj = (symbol*)prog.allocate_back(obj_len, cmd_symbol);
|
symbol* new_obj = (symbol*)prog.allocate_back(obj_len, cmd_symbol);
|
||||||
new_obj->_auto_eval = false;
|
new_obj->set("", 0, false);
|
||||||
new_obj->set("", 0);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -228,9 +228,9 @@ static bool get_symbol(const string& entry, program& prog, string& remaining_ent
|
||||||
obj_len = sizeof(symbol)+naked_entry_len+1;
|
obj_len = sizeof(symbol)+naked_entry_len+1;
|
||||||
|
|
||||||
// allocate and set object
|
// allocate and set object
|
||||||
|
// symbol beginning with ' is not autoevaluated
|
||||||
symbol* new_obj = (symbol*)prog.allocate_back(obj_len, cmd_symbol);
|
symbol* new_obj = (symbol*)prog.allocate_back(obj_len, cmd_symbol);
|
||||||
new_obj->_auto_eval = false;
|
new_obj->set(entry.substr(1, naked_entry_len).c_str(), naked_entry_len, false);
|
||||||
new_obj->set(entry.substr(1, naked_entry_len).c_str(), naked_entry_len);
|
|
||||||
}
|
}
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
|
@ -255,9 +255,9 @@ static bool get_other(const string& entry, program& prog, string& remaining_entr
|
||||||
obj_len = sizeof(symbol)+naked_entry_len+1;
|
obj_len = sizeof(symbol)+naked_entry_len+1;
|
||||||
|
|
||||||
// allocate and set object
|
// allocate and set object
|
||||||
|
// symbol not beginning with ' is autoevaluated (ie is evaluated when pushed on stack)
|
||||||
symbol* new_obj = (symbol*)prog.allocate_back(obj_len, cmd_symbol);
|
symbol* new_obj = (symbol*)prog.allocate_back(obj_len, cmd_symbol);
|
||||||
new_obj->set(entry.c_str(), naked_entry_len);
|
new_obj->set(entry.c_str(), naked_entry_len, true);
|
||||||
new_obj->_auto_eval = true;
|
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ void type()
|
||||||
unsigned int string_size = strlen(cmd_type_string[type]);
|
unsigned int string_size = strlen(cmd_type_string[type]);
|
||||||
unsigned int size = sizeof(symbol)+string_size+1;
|
unsigned int size = sizeof(symbol)+string_size+1;
|
||||||
symbol* sym = (symbol*)allocate_back(size, cmd_symbol);
|
symbol* sym = (symbol*)allocate_back(size, cmd_symbol);
|
||||||
sym->set(cmd_type_string[type], string_size);
|
sym->set(cmd_type_string[type], string_size, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rpn_default()
|
void rpn_default()
|
||||||
|
|
|
@ -319,9 +319,11 @@ struct oprogram : public object
|
||||||
struct symbol : public object
|
struct symbol : public object
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
void set(const char* value, unsigned int len)
|
void set(const char* value, unsigned int len, bool auto_eval)
|
||||||
{
|
{
|
||||||
_type = cmd_symbol;
|
_type = cmd_symbol;
|
||||||
|
_auto_eval = auto_eval;
|
||||||
|
|
||||||
if (value != NULL)
|
if (value != NULL)
|
||||||
{
|
{
|
||||||
if (len>0)
|
if (len>0)
|
||||||
|
|
Loading…
Reference in a new issue