Use reference counted table in libab.
This commit is contained in:
@@ -6,14 +6,14 @@
|
||||
#include "tree.h"
|
||||
|
||||
struct libab_interpreter_s {
|
||||
libab_table* base_table;
|
||||
libab_ref base_table;
|
||||
libab_number_impl* impl;
|
||||
};
|
||||
|
||||
typedef struct libab_interpreter_s libab_interpreter;
|
||||
|
||||
void libab_interpreter_init(libab_interpreter* intr,
|
||||
libab_table* table, libab_number_impl* impl);
|
||||
libab_ref* table, libab_number_impl* impl);
|
||||
libab_result libab_interpreter_run(libab_interpreter* intr,
|
||||
libab_tree* tree, libab_ref* into);
|
||||
void libab_interpreter_free(libab_interpreter* intr);
|
||||
|
||||
@@ -29,7 +29,7 @@ struct libab_s {
|
||||
* The table used to store top-level
|
||||
* things like functions and operators.
|
||||
*/
|
||||
libab_table table;
|
||||
libab_ref table;
|
||||
/**
|
||||
* The number implementation used by this instance.
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* tokens into trees.
|
||||
*/
|
||||
struct libab_parser_s {
|
||||
libab_table* base_table;
|
||||
libab_ref base_table;
|
||||
};
|
||||
|
||||
typedef struct libab_parser_s libab_parser;
|
||||
@@ -22,7 +22,7 @@ typedef struct libab_parser_s libab_parser;
|
||||
* @param parser the parser to intialize.
|
||||
* @param table the table of "reserved" entries like operators.
|
||||
*/
|
||||
void libab_parser_init(libab_parser* parser, libab_table* table);
|
||||
void libab_parser_init(libab_parser* parser, libab_ref* table);
|
||||
/**
|
||||
* Parses the given list of tokens into the given tree pointer.
|
||||
* @param parser the parser to use for parsing text.
|
||||
|
||||
@@ -65,5 +65,12 @@ libab_result libab_resolve_parsetype(libab_parsetype* to_resolve,
|
||||
*/
|
||||
libab_result libab_instantiate_basetype(libab_basetype* to_instantiate,
|
||||
libab_ref* into, size_t n, ...);
|
||||
/**
|
||||
* Creates a new libab_table, and stores it into the given reference.
|
||||
* @param into the reference to store the table into.
|
||||
* @param parent the parent reference to store.
|
||||
* @return the result of the instantiation.
|
||||
*/
|
||||
libab_result libab_create_table(libab_ref* into, libab_ref* parent);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user