C API Engine functions
Contents
- 1 Core engine
- 1.1 rl3_engine_create
- 1.2 rl3_engine_init
- 1.3 rl3_engine_load
- 1.4 rl3_engine_destroy
- 1.5 rl3_engine_has_error
- 1.6 rl3_engine_get_error_str
- 1.7 rl3_engine_is_debug_mode
- 1.8 rl3_engine_set_debug_mode
- 1.9 rl3_engine_is_update_mode
- 1.10 rl3_engine_set_update_mode
- 1.11 rl3_engine_execute
- 1.12 rl3_engine_update
- 2 RL3 engine specific
- 3 KML engine specific
Core engine
rl3_engine_create
struct RL3_Engine* rl3_engine_create();
Create a new uninitialized engine structure.
Returns: | a pointer to a new engine structure |
rl3_engine_init
void rl3_engine_init(struct RL3_Engine* engine, const char* engine_type);
Initialize an engine.
engine: | a pointer to an engine structure to be initialized |
engine_type: | "rl3" to initialize as an RL3 engine, or "kml" to initialize as a KML engine
|
Returns: | nothing |
rl3_engine_load
void rl3_engine_load(struct RL3_Engine* engine, const char* file_path, unsigned char silent);
Load a compiled engine model from file.
engine: | a pointer to an engine structure |
file_path: | path to model file |
silent: | 1 to suppress system messages, 0 otherwise
|
Returns: | nothing |
rl3_engine_destroy
void rl3_engine_destroy(struct RL3_Engine* engine);
Delete an engine structure and release associated resources.
engine: | a pointer to an engine structure |
Returns: | nothing |
rl3_engine_has_error
unsigned char rl3_engine_has_error(struct RL3_Engine* engine);
Check if last interface function call has failed.
engine: | pointer to engine structure |
Returns: | 1 if last interface function call has failed, 0 otherwise
|
rl3_engine_get_error_str
const char* rl3_engine_get_error_str(struct RL3_Engine* engine);
Return error message.
engine: | a pointer to an engine structure |
Returns: | an error message |
rl3_engine_is_debug_mode
unsigned char rl3_engine_is_debug_mode(struct RL3_Engine* engine);
Check if debug mode is enabled.
engine: | a pointer to an engine structure |
Returns: | 1 if a debug mode is enabled, 0 otherwise
|
rl3_engine_set_debug_mode
void rl3_engine_set_debug_mode(struct RL3_Engine* engine, unsigned char mode);
Enable or disable debug mode.
engine: | pointer to engine structure |
mode: | 1 to enable debug mode, 0 to disable debug mode
|
Returns: | nothing |
rl3_engine_is_update_mode
unsigned char rl3_engine_is_update_mode(struct RL3_Engine* engine);
Check if update mode is enabled.
engine: | a pointer to an engine structure |
Returns: | 1 if an update mode is enabled, 0 otherwise
|
rl3_engine_set_update_mode
void rl3_engine_set_update_mode(struct RL3_Engine* engine, unsigned char mode);
Enable or disable update mode.
engine: | a pointer to an engine structure |
mode: | 1 to enable update mode, 0 to disable update mode
|
Returns: | nothing |
rl3_engine_execute
unsigned char rl3_engine_execute(struct RL3_Engine* engine, const struct RL3_Factsheet* premises, struct RL3_Factsheet* conclusions);
Execute engine on an input factsheet and add resulting facts to an output factsheet.
engine: | a pointer to an engine structure |
premises: | input factsheet |
conclusions: | output factsheet |
Returns: | 1 if new fact were asserted, 0 otherwise
|
rl3_engine_update
unsigned char rl3_engine_update(struct RL3_Engine* engine, struct RL3_Factsheet* factsheet);
Execute engine on input factsheet and update it with new (resulting) facts.
engine: | a pointer to an engine structure |
factsheet: | input and output factsheet |
Returns: | 1 if new fact were asserted, 0 otherwise
|
RL3 engine specific
RL3 engine specific functions enable to perform parsing and compiling RL3 sources directly (rather than loading an engine model already compiled from RL3 sources).
![]() | The following functions become available in case an initialized engine is of the RL3 type. |
rl3_engine_parse_inline
void rl3_engine_parse_inline(struct RL3_Engine* engine, const char* definitions, const char* stdlib_path, unsigned char silent);
Perform an inline parse of the source.
TBD!!!: clarify whether stdlib_path can be indicated as null or an empty string
engine: | a pointer to an engine structure |
definitions: | a source to be parsed |
stdlib_path: | path to the standard library |
silent: | 1 to suppress system messages, 0 otherwise
|
Returns: | nothing |
rl3_engine_parse_project
void rl3_engine_parse_project(struct RL3_Engine* engine, const char* project_file_path, const char* stdlib_path, unsigned char silent);
Perform parsing of the project.
engine: | a pointer to an engine structure |
project_file_path: | a path to the project file (containing multiple modules). |
stdlib_path: | a path to the standard library |
silent: | 1 to suppress system messages, 0 otherwise
|
Returns: | nothing |
rl3_engine_parse_module
void rl3_engine_parse_module(struct RL3_Engine* engine, const char* module_file_path, const char* stdlib_path, unsigned char silent);
Perform parsing of a single module.
engine: | a pointer to an engine structure |
module_file_path: | a path to the module file. |
stdlib_path: | a path to the standard library |
silent: | 1 to suppress system messages, 0 otherwise
|
Returns: | nothing |
rl3_engine_link
void rl3_engine_link(struct RL3_Engine* engine, unsigned char silent);
Link data from single parses.
engine: | a pointer to an engine structure |
silent: | 1 to suppress system messages, 0 otherwise
|
Returns: | nothing |
rl3_engine_save
void rl3_engine_save(struct RL3_Engine* engine, const char* file_path);
Save the file with compiled output.
engine: | a pointer to an engine structure |
file_path: | a path where a saved file is to be created |
Returns: | nothing |
KML engine specific
TBD!!! Clarify
![]() | The following functions become available in case an initialized engine is of the KML type. |
rl3_engine_claim_input
void rl3_engine_claim_input(struct RL3_Engine* engine, const char* input);
rl3_engine_claim_output
void rl3_engine_claim_output(struct RL3_Engine* engine, const char* output);