Hyperon C
Loading...
Searching...
No Matches
Grounded Atom Interface

Interface to define custom atoms implemented with C. More...

Classes

struct  exec_error_t
 Represents a status used to communicate between Grounded Atom execution and the MeTTa interpreter. More...
struct  gnd_api_t
 A table of callback functions to implement a Grounded Atom with behavior defined in C. More...
struct  gnd_t
 A struct header that must preface a buffer used as a backing object for a Grounded Atom. More...

Functions

struct exec_error_t exec_error_runtime (const char *message)
 Creates a new exec_error_t representing a runtime error that will halt the MeTTa interpreter.
struct exec_error_t exec_error_no_reduce (void)
 Creates a new exec_error_t representing a "Don't Reduce" status, telling the MeTTa interpreter to process the atoms as they are.
struct exec_error_t exec_error_incorrect_argument (void)
 Creates a new exec_error_t representing a "Incorrect Argument" status, telling the MeTTa interpreter that argument was not recognized by the function implementation.
struct exec_error_t exec_error_no_err (void)
 Creates a new exec_error_t representing a "No Error" status. This is the default interpreter status.
void exec_error_free (struct exec_error_t error)
 Frees an exec_error_t
void throw_panic_with_message (const char *message)
 Used to throw panic from C Api with message to prevent panics without any info.

Detailed Description

Interface to define custom atoms implemented with C.

Providing the functions in gnd_api_t allows custom atom behaviors to be implemented using C.

Function Documentation

◆ exec_error_free()

void exec_error_free ( struct exec_error_t error)

Frees an exec_error_t

Parameters
[in]errorThe exec_error_t to free

◆ exec_error_incorrect_argument()

struct exec_error_t exec_error_incorrect_argument ( void )

Creates a new exec_error_t representing a "Incorrect Argument" status, telling the MeTTa interpreter that argument was not recognized by the function implementation.

Returns
The newly created exec_error_t
Note
The caller must take ownership responsibility for the returned exec_error_t, and ultimately free it with exec_error_free() or return it from an execute function

◆ exec_error_no_err()

struct exec_error_t exec_error_no_err ( void )

Creates a new exec_error_t representing a "No Error" status. This is the default interpreter status.

Returns
The newly created exec_error_t
Note
The caller must take ownership responsibility for the returned exec_error_t, and ultimately free it with exec_error_free() or return it from an execute function

◆ exec_error_no_reduce()

struct exec_error_t exec_error_no_reduce ( void )

Creates a new exec_error_t representing a "Don't Reduce" status, telling the MeTTa interpreter to process the atoms as they are.

Returns
The newly created exec_error_t
Note
The caller must take ownership responsibility for the returned exec_error_t, and ultimately free it with exec_error_free() or return it from an execute function

◆ exec_error_runtime()

struct exec_error_t exec_error_runtime ( const char * message)

Creates a new exec_error_t representing a runtime error that will halt the MeTTa interpreter.

Parameters
[in]messageA human-readable error message, for the interpreter to propagate to the user
Returns
The newly created exec_error_t
Note
The caller must take ownership responsibility for the returned exec_error_t, and ultimately free it with exec_error_free() or return it from an execute function

◆ throw_panic_with_message()

void throw_panic_with_message ( const char * message)

Used to throw panic from C Api with message to prevent panics without any info.

Parameters
[in]messageA human-readable error message which will be used to throw a panic
Returns
()