|
Hyperon C
|
Functions for working directly with atoms. More...
Classes | |
| struct | atom_ref_t |
| Refers to an Atom owned by another object. More... | |
| struct | atom_t |
| Represents an Atom of any type. More... | |
Typedefs | |
| typedef void(* | c_atom_callback_t) (atom_ref_t atom, void *context) |
| Function signature for a callback providing access to an atom. | |
Enumerations | |
| enum | atom_type_t { SYMBOL , VARIABLE , EXPR , GROUNDED } |
| Represents whether an atom is a Symbol, Variable, Expression, or Grounded atom. More... | |
Functions | |
| atom_ref_t | atom_ref (const atom_t *atom) |
| Create an atom_ref_t that points to another atom you own. | |
| atom_ref_t | atom_ref_null (void) |
| Create an atom_ref_t that points nothing. | |
| atom_t | atom_sym (const char *name) |
| Create a new Symbol atom with the specified name. | |
| atom_t | atom_expr (atom_t *children, uintptr_t size) |
| Create a new Expression atom with the specified children atoms. | |
| atom_t | atom_expr_from_vec (struct atom_vec_t children) |
| Create a new Expression atom with the children contained in an atom_vec_t | |
| atom_t | atom_var (const char *name) |
| Create a new Variable atom with the specified name. | |
| atom_t | atom_var_parse_name (const char *name) |
| Create a new Variable atom parsing full formatted name of the variable. | |
| atom_t | atom_gnd (struct gnd_t *gnd) |
| atom_t | atom_bool (bool b) |
| atom_t | atom_int (int64_t n) |
| atom_t | atom_float (double f) |
| atom_t | atom_gnd_for_space (const struct space_t *space) |
| Creates a Grounded Atom referencing a Space. | |
| void | atom_free (atom_t atom) |
| Frees an atom and all associated resources. | |
| atom_t | atom_clone (const atom_ref_t *atom) |
| Makes a "deep copy" of an atom. Useful to turn an atom_ref_t into an atom_t | |
| bool | atom_eq (const atom_ref_t *a, const atom_ref_t *b) |
| Checks if two atom objects represent the same conceptual atom. | |
| bool | atoms_are_equivalent (const atom_ref_t *a, const atom_ref_t *b) |
| Checks if two atoms are alpha equivalent. | |
| enum atom_type_t | atom_get_metatype (const atom_ref_t *atom) |
| Returns the metatype of an atom. | |
| bool | atom_is_null (const atom_ref_t *atom) |
| Returns true if the referenced atom is invalid, otherwise returns false | |
| uintptr_t | atom_to_str (const atom_ref_t *atom, char *buf, uintptr_t buf_len) |
| Renders a human-readable text description of an atom. | |
| uintptr_t | atom_get_name (const atom_ref_t *atom, char *buf, uintptr_t buf_len) |
| Renders the name of an atom into a text buffer. | |
| void | atom_get_children (const atom_ref_t *atom, c_atom_vec_callback_t callback, void *context) |
| Provides access to all children atoms within an expression atom. | |
| void | atom_iterate (const atom_ref_t *atom, c_atom_callback_t callback, void *context) |
| Performs a depth-first exhaustive iteration of an atom and all its children recursively. | |
| atom_t | atom_get_grounded_type (const atom_ref_t *atom) |
| Retrieve the grounded type of a Grounded Atom. | |
| struct gnd_t * | atom_get_object (const atom_ref_t *atom) |
| Access a pointer to an object backing a Grounded Atom. | |
| bool | atom_is_cgrounded (const atom_ref_t *atom) |
| Check if the atom refers to CGrounded object. | |
| struct space_t | atom_get_space (const atom_ref_t *atom) |
| Access the space wrapped inside a Grounded atom. | |
Functions for working directly with atoms.
These functions are used to create, inspect, modify, and free atoms.
| typedef void(* c_atom_callback_t) (atom_ref_t atom, void *context) |
Function signature for a callback providing access to an atom.
| [in] | atom | A reference to the atom. This atom should not be modified or freed by the callback. |
| [in] | context | The context state pointer initially passed to the upstream function initiating the callback. |
| enum atom_type_t |
| atom_t atom_bool | ( | bool | b | ) |
| atom_t atom_clone | ( | const atom_ref_t * | atom | ) |
Makes a "deep copy" of an atom. Useful to turn an atom_ref_t into an atom_t
| [in] | atom | A pointer to an atom_t or an atom_ref_t to clone |
| bool atom_eq | ( | const atom_ref_t * | a, |
| const atom_ref_t * | b ) |
Checks if two atom objects represent the same conceptual atom.
| [in] | a | A pointer to an atom_t or an atom_ref_t representing the first atom |
| [in] | b | A pointer to an atom_t or an atom_ref_t representing the second atom |
Create a new Expression atom with the specified children atoms.
| [in] | children | A packed buffer of atom_t *, representing the children atoms |
| [in] | size | The number of elements in children |
| atom_t atom_expr_from_vec | ( | struct atom_vec_t | children | ) |
Create a new Expression atom with the children contained in an atom_vec_t
| [in] | children | An atom_vec_t containing all children atoms |
| atom_t atom_float | ( | double | f | ) |
| void atom_free | ( | atom_t | atom | ) |
Frees an atom and all associated resources.
| [in] | atom | The atom to free |
| void atom_get_children | ( | const atom_ref_t * | atom, |
| c_atom_vec_callback_t | callback, | ||
| void * | context ) |
Provides access to all children atoms within an expression atom.
| [in] | atom | A pointer to an atom_t or an atom_ref_t to access |
| [in] | callback | A function that will be called to return access to each atom |
| [in] | context | A pointer to a caller-defined structure to facilitate communication with the callback function |
| atom_t atom_get_grounded_type | ( | const atom_ref_t * | atom | ) |
Retrieve the grounded type of a Grounded Atom.
| [in] | atom | A pointer to an atom_t or an atom_ref_t to access |
| enum atom_type_t atom_get_metatype | ( | const atom_ref_t * | atom | ) |
Returns the metatype of an atom.
| [in] | atom | A pointer to an atom_t or an atom_ref_t to inspect |
| uintptr_t atom_get_name | ( | const atom_ref_t * | atom, |
| char * | buf, | ||
| uintptr_t | buf_len ) |
Renders the name of an atom into a text buffer.
| [in] | atom | A pointer to an atom_t or an atom_ref_t to get the name of |
| [out] | buf | A buffer into which the text will be written |
| [in] | buf_len | The maximum allocated size of buf |
| struct gnd_t * atom_get_object | ( | const atom_ref_t * | atom | ) |
Access a pointer to an object backing a Grounded Atom.
| [in] | atom | A pointer to an atom_t or an atom_ref_t to access |
| struct space_t atom_get_space | ( | const atom_ref_t * | atom | ) |
Access the space wrapped inside a Grounded atom.
| [in] | atom | A pointer to an atom_t or an atom_ref_t that wraps a Space |
Creates a Grounded Atom referencing a Space.
| [in] | space | A pointer to an space_t for accessing the space |
| atom_t atom_int | ( | int64_t | n | ) |
| bool atom_is_cgrounded | ( | const atom_ref_t * | atom | ) |
Check if the atom refers to CGrounded object.
| [in] | atom | A pointer to an atom_t or an atom_ref_t to access |
| bool atom_is_null | ( | const atom_ref_t * | atom | ) |
Returns true if the referenced atom is invalid, otherwise returns false
| [in] | atom | A pointer to an atom_t or an atom_ref_t to inspect |
| void atom_iterate | ( | const atom_ref_t * | atom, |
| c_atom_callback_t | callback, | ||
| void * | context ) |
Performs a depth-first exhaustive iteration of an atom and all its children recursively.
| [in] | atom | A pointer to an atom_t or an atom_ref_t to iterate |
| [in] | callback | A function that will be called to return access to each contained atom |
| [in] | context | A pointer to a caller-defined structure to facilitate communication with the callback function |
| atom_ref_t atom_ref | ( | const atom_t * | atom | ) |
Create an atom_ref_t that points to another atom you own.
| [in] | atom | The atom to reference |
Returns an atom_ref_t that points to the supplied atom.
| atom_ref_t atom_ref_null | ( | void | ) |
Create an atom_ref_t that points nothing.
Returns an atom_ref_t that does not point to any atom
| atom_t atom_sym | ( | const char * | name | ) |
| uintptr_t atom_to_str | ( | const atom_ref_t * | atom, |
| char * | buf, | ||
| uintptr_t | buf_len ) |
Renders a human-readable text description of an atom.
| [in] | atom | A pointer to an atom_t or an atom_ref_t to render |
| [out] | buf | A buffer into which the text will be rendered |
| [in] | buf_len | The maximum allocated size of buf |
| atom_t atom_var | ( | const char * | name | ) |
| atom_t atom_var_parse_name | ( | const char * | name | ) |
Create a new Variable atom parsing full formatted name of the variable.
| [in] | name | The name for the newly created Variable atom in a format <name>#id |
| bool atoms_are_equivalent | ( | const atom_ref_t * | a, |
| const atom_ref_t * | b ) |
Checks if two atoms are alpha equivalent.
| [in] | a | A pointer to an atom_t or an atom_ref_t representing the first atom |
| [in] | b | A pointer to an atom_t or an atom_ref_t representing the second atom |