-
Notifications
You must be signed in to change notification settings - Fork 40
C API
Patrick Hammer edited this page Oct 15, 2020
·
4 revisions
How to use ONA’s C API
The C API can easily be invoked/wrapped from higher-level languages. Though the recommended way to integrate the system is standard-IO via shell: https://github.com/opennars/OpenNARS-for-Applications/wiki/Shell
Initializes the system:
void NAR_INIT();
Run the system for a certain amount of cycles:
void NAR_Cycles(int cycles);
Add a Narsese sentence:
(for the format of the string, see https://github.com/opennars/OpenNARS-for-Applications/wiki/Narsese )
void NAR_AddInputNarsese(char *narsese_sentence);
Add an operation
links an operator name like ^say, to a procedure with the operator arguments as input the system can invoke whenever it desires to.
void NAR_AddOperation(char *operator_name, Action procedure);
Note: the operator arguments are given as a product term (arg1 * tailProduct)