Embedding Zenroom

Zenroom is designed to facilitate embedding into other native applications and high-level scripting languages. The stable releases distribute compiled library components for Apple/iOS and Google/Android platforms, as well MS/Windows DLL. Golang bindings and a Jupyter kernel are also in experimental phase.

To call Zenroom from an host program is very simple, since there isn’t an API of calls, but a single call to execute scripts and return their results. The call is called zenroom_exec and prints results to the “stderr/stdout” terminal output. Its prototype is common to all libraries:

The input buffers are all read-only, here their functions: - script: a long string containing the script to be executed - conf: a short configuration string (for now only umm supported as value) - keys: a string often JSON formatted that contains keys (sensitive information) - data: a string (also JSON formatted) that contains data - verbosity: a number from 1 to 3 activating more debugging messages

In addition to this function there is another one that copies results (error messages and printed output) inside memory buffers:

In addition to the previously explained arguments, the new ones are: - stdout_buf: pre-allocated buffer by the caller where to copy stdout - stdout_len: maximum length of the pre-allocated stdout buffer - stderr_buf: pre-allocated buffer by the called where to copy stderr - stderr_len: maximum length of the pre-allocated stderr buffer

At last a third call is provided not to execute the script, but to obtain its JSON formatted Abstract Syntax Tree (AST) inside a provided buffer:

generated by LDoc 1.4.3 Last updated 2018-10-01 18:53:47
]==]