[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.18 Scripting Languages

Written by Eric Sunshine, sunshine@sunshineco.com.

Crystal Space features bindings for several popular scripting and higher-level languages. The list of languages includes Java, Perl, and Python.

Some scripting language bindings also have corresponding Crystal Space plugins. These can be loaded like any other plugins, and allow your C++ program to interact with scripting code. Such plugins implement the ‘iScript’ interface (see section The iScript Interface), and it is by this interface that C++ code communicates with the scripting side. Conversely, scripting code can interact with Crystal Space itself since most of the Crystal Space classes and interfaces have been exported to the scripting side with the bindings.

Some of the bindings are available as pure scripting modules which can be imported directly into scripting code. This particularly powerful facility allows you to create Crystal Space applications entirely in the scripting language without writing any C++ code at all. Examples of these types of scripts can be found in the installed scripting support directories at:

${prefix}/share/crystalspace/bindings

where ${prefix} is the installation location (typically, ‘/usr/local’). If you have not installed Crystal Space, then see the various subdirectories of ‘CS/scripts’.

Crystal Space uses Swig (http://www.swig.org/) to generate its language bindings. The technology has been generalized enough that the supported languages share a common Swig interface definition (‘include/bindings/cspace.i’). Each language also has its own specific definition files (‘include/bindings/*/*.i’). Because the binding definitions are generalized, it should be possible to leverage off of ‘include/bindings/cspace.i’ to create additional Crystal Space bindings for any of the other languages supported by Swig with a minimal amount of effort.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated using texi2html 1.76.