An Embeddable Scripting Engine |
Tweet |
Follow @jx9_engine |
Frequently Asked Questions.
-
Jx9 is an embeddable scripting language and API (Also called scripting engine or extension language) with concepts similar to Lua.
Jx9 implements a Turing complete, dynamically typed programming language (also called Jx9) which uses a familiar and clean syntax similar to C, JavaScript and JSON.
-
Jx9 is a very useful library for applications that require modern and efficient scripting support such as games, web servers, database manager, text editors and so forth.
-
Jx9 is very easy to learn, even for new programmer. Here is some useful links to start with:
Jx9 In 5 Minutes Or Less gives a high-level overview on the how to embed Jx9 in a host application.
An Introduction To The Jx9 C/C++ Interface gives an overview and roadmap to the C/C++ interface to Jx9.The Jx9 Programming Language. Is the official reference manual for the programming language implemented by Jx9.
Download some working examples from the download page.
-
Where can I find the simplest C program that embed Jx9.
Compile this C File. This program compile and execute a simple Jx9 script that display a greeting message, the current system time and the host operating system.
The download page includes very useful working examples implemented in C to help you understand the Jx9 C/C++ API.
-
Where can I find online community support
Need some help, visit the Jx9 support page for additional information.
-
Jx9 is an open source, dual licensed product available free of charge for open source projects under the term of the Symisc Public License (SPL) which is GPL compatible. See the licensing page for additional information.
-
Jx9 is written in ANSI C, compiles unmodified and should run in any platform including restricted embedded devices with a C compiler. Jx9 is extensively tested on Windows and UNIX systems especially Linux, FreeBSD, Oracle Solaris and Mac OS X. If you have successfully compiled Jx9 in an exotic environment, please post a report on the Jx9 forums or send an email to devel@symisc.net
-
How can I create a foreign function and call it from my Jx9 code
Create a C/C++ function performing the desired computation then register it using the jx9_create_function() interface. After that, the foreign function can be called from your Jx9 script.
See this tutorial for additional information.
-
How can I create a foreign constant and expand its value from my Jx9 code
Create a C/C++ function responsible of expanding the constant name to the desired value then register it using the jx9_create_constant() interface. After that, the installed constant can be expanded from your Jx9 script.
See this tutorial for additional information.
-
How can I extract JSON Object/Array values inside my foreign function
Create a walker callback first then invoke it using a call to jx9_array_walk() or call the jx9_array_fetch() interface to fetch a single Object/Array entry value. These interfaces are unified for JSON objects and arrays.
See this tutorial for additional information.
-
How can I return a JSON Object/Array from my foreign function
Inside your C function, create a new JSON object or array using the jx9_context_new_array() interface (This interface and its wrapper are unified for JSON arrays as well JSON objects). After that, populate your freshly created array or object using one more calls to jx9_array_add_elem() and/or its wrapper interfaces. When done return the created array/object using the jx9_result_value() interface.
See this tutorial for additional information.
-
How can I configure my virtual machine with a HTTP request
First off, read the full HTTP request from the connected peer using the standard system calls such as read() or recv(). After that you must configure your virtual machine using the jx9_vm_config() interface with a configuration verb set to Jx9_VM_CONFIG_HTTP_REQUEST with the HTTP request just read. Now you can extract HTTP request information from your Jx9 code using the $_GET, $_POST JSON objects or any other related predefined variables.
-
How can I output a message from my foreign function
Inside your C/C++ function, simply call jx9_context_output() or jx9_context_output_format() with the desired message to output. This is used to mimic the Jx9 print construct.
See this tutorial for additional information.
-
How can I throw an error from my foreign function
Inside your C/C++ function, simply call jx9_context_throw_error() or jx9_context_throw_error_format() with the desired error message to output.
See this tutorial for additional information.
-
How can I stop program execution from my foreign function
If something goes wrong while performing the computation inside your foreign function and you want to abort the virtual machine execution immediately and thus to mimic the Jx9 die construct, simply return JX9_ABORT instead of JX9_OK.
See this tutorial for additional information.
-
Threads are evil. Avoid them.
Jx9 is threadsafe. We make this concession since many users choose to ignore the advice given in the previous paragraph. But in order to be thread-safe, Jx9 must be compiled with the JX9_ENABLE_THREADS compile time directive defined. If you are unsure if the Jx9 library you are linking against is compiled to be threadsafe you can call the jx9_lib_is_threadsafe() interface to find out.
-
How can I return a multi-dimensional JSON array from my foreign function
Inside your C function, create a new JSON array using the jx9_context_new_array() interface, then create another array using the same interface. After that, populate the second array with the desired values (including other arrays). When done insert the second array in the first one using one or more calls to jx9_array_add_elem() and/or its wrapper interfaces. When done return the created array using the jx9_result_value() interface.
See this tutorial for additional information.
-
How can I contribute to the Jx9 development
If you want to involve in the Jx9 development process, please sign-up and post a message in the Jx9 devel mailing list or send an email to devel@symisc.net.
If you have/can write a wrapper/binding for a foreign programming language, again post a message in the Jx9 forums or the devel mailing list or send an email to devel@symisc.net
-
You can report bugs in the Jx9 mailing list, the Jx9 forums or the online bug tracker. Visit the support page for additional information.