Add true / false values to interpreter.

This commit is contained in:
2018-08-10 15:29:56 -07:00
parent 25f5d3469b
commit 7c8c547540
4 changed files with 87 additions and 0 deletions

View File

@@ -28,6 +28,14 @@ struct libab_interpreter_s {
* The unit value, which doesn't need more than one instance.
*/
libab_ref value_unit;
/**
* The "true" boolean value, which doesn't need more than one instance.
*/
libab_ref value_true;
/**
* The "false" boolean value, which doesn't need more than one instance.
*/
libab_ref value_false;
};
typedef enum libab_interpreter_scope_mode_e libab_interpreter_scope_mode;
@@ -73,6 +81,18 @@ libab_result libab_interpreter_run_function(libab_interpreter* intr,
* @param into the reference into which to store the unit value.
*/
void libab_interpreter_unit_value(libab_interpreter* intr, libab_ref* into);
/**
* Gets the true value from this interpreter.
* @param intr the interpreter from which to get the true value.
* @param into the reference into which to store the true value.
*/
void libab_interpreter_true_value(libab_interpreter* intr, libab_ref* into);
/**
* Gets the false value from this interpreter.
* @param intr the interpreter from which to get the false value.
* @param into the reference into which to store the false value.
*/
void libab_interpreter_false_value(libab_interpreter* intr, libab_ref* into);
/**
* Frees the given interpreter.
* @param intr the interpreter to free.

View File

@@ -204,6 +204,18 @@ void libab_get_type_unit(libab* ab, libab_ref* into);
* @param into the reference into which to store the unit value.
*/
void libab_get_unit_value(libab* ab, libab_ref* into);
/**
* Gets the true value form this libab instance.
* @param ab the instance to get the true value from.
* @param into the reference into which to store the true value.
*/
void libab_get_true_value(libab* ab, libab_ref* into);
/**
* Gets the false value form this libab instance.
* @param ab the instance to get the false value from.
* @param into the reference into which to store the false value.
*/
void libab_get_false_value(libab* ab, libab_ref* into);
/**
* Executes the given string of code.