Add way to get string basetype.

This commit is contained in:
Danila Fedorin 2018-09-02 16:21:16 -07:00
parent 441e69065e
commit 13aa227470
2 changed files with 5 additions and 0 deletions

View File

@ -19,6 +19,7 @@ class abacus {
libab_basetype basetype_string = { [](void* s) { delete ((string*) s); }, NULL, 0 }; libab_basetype basetype_string = { [](void* s) { delete ((string*) s); }, NULL, 0 };
public: public:
abacus(); abacus();
const libab_basetype* get_basetype_string();
void add_variable(const std::string& name, ref val); void add_variable(const std::string& name, ref val);
void add_function(const std::string& name, libab_function_ptr ptr, const std::string& type); void add_function(const std::string& name, libab_function_ptr ptr, const std::string& type);
void add_operator_infix(const std::string& op, const std::string& func, int assoc, int prec); void add_operator_infix(const std::string& op, const std::string& func, int assoc, int prec);

View File

@ -13,6 +13,10 @@ abacus::abacus() {
libab_create_table(&ab, scope, &ab.table); libab_create_table(&ab, scope, &ab.table);
} }
const libab_basetype* abacus::get_basetype_string() {
return &basetype_string;
}
void abacus::add_variable(const std::string& name, ref val) { void abacus::add_variable(const std::string& name, ref val) {
libab_table_entry* entry = libab_table_search_entry_value(get<libab_table>(scope), name.c_str()); libab_table_entry* entry = libab_table_search_entry_value(get<libab_table>(scope), name.c_str());
if(entry) { if(entry) {