The Script Interface Objects

After the framework group decided it wanted to link together a script system (Python) and C++ we needed some sort of interface. It was built with the following requirements in mind:

Most of these goals have been achieved.


Basic Object Design

Exposing a C++ object to the script system

Any object that is to be visible to the script system must inherit from d0script_object. It then overrides the virtual methods is_method_name, dispatch_method_call, script_get_value, script_et_value, and get_object_name.

Once the object has overridden these methods, it is ready to be associated with a script system object. While possible to do generically, it has only been done for d0 packags currently.

Exposing a Script System Object to C++

When an object is passed back to C++, it is wrapped in a d0_script_object subclass. One then uses the above routines to access the script object.

Variables

Of course, to be useful, variables and objects must be exposed. The object d0script_value encloses just this behavior. It contains conversion routines to convert from the script system's format to C++ (integer and string at the moment). Getting a local value from C++ to the script system take a similar path.

Script System Independence

This means it should be possible to change the script system (from Python to TCL, etc.) without altering source code. In theory, one should not even have to recompile the source. The original design was to be able to run with more than on scipt system simulataniously, in fact.

This is achived by keeping two layers of objects. One layer is script system specific. Each of these objects is subclassed for a class specific to the script system. These objects are used by the second layer, which is independent of the script system.


ToDo


Gordon Watts 12/10/96