[Contents] [TitleIndex] [WordIndex

Weekly report for 09 July 2011 on Project "dotNET Interaction Mechanism for Scilab + Environment Abstraction Layer"

This week I have finished abstraction in JIMS, but there may be some fixes required, because I did not test it properly yet. So, the task for the next week is not make sure, that JIMS works as before. Then integrating new environment will be pretty easy.

Environment identification

The idea behind abstraction on gateway level is, that scilab-functions for different environments will be bound to the same gateway functions, e.g. jinvoke and dotnetinvoke will be bound to sci_invoke() gateway function. This functions receive a name of scilab function, which calls them. I have implemented a factory class (ScilabAbstractEnvironmentFactory), which defines by scilab-function name proper environment an returns a pointer to this environment, which is stored in a map and is created during first request of the environment.

Mlist types _EnvObj(_JObj before) and _EnvClass(_JClass before) have been modified to contain an id of environment, they belong to. So, if in Scilab user invokes a Java function with .NET environment arguments, he will get an error. But, there are also new possibilities to see in such usage. For example, for basic types and arrays of basic types calling Java functions with arguments from basic types from .NET environment could be a great feature for interaction between Java and .NET through Scilab (which must to objects unwrapping from one environment and wrapping for another). This is an interesting feature to implement in JIMS in future.


The most painful refactoring was done with wrappers/unwrappers, which are placed in a separate class ScilabAbstractEnvironmentWrapper and it's anscestors. Structs JIMSScilabAnOtherWrapper##Type##__ now get a ScilabAbstractEnvironmentWrapper from factory and call it's corresponding members, which are defined by macro in ScilabJavaEnvironment implementation. This definitions have been moved to ScilabObjects.hxx to resolve circular dependencies.

Environment initialization

Initialization of environment is now done in constructor of Scilab...Environment class, which is private and can be used by a friend factory class ScilabAbstractEnvironmentFactory.

There is a special null-object for environment, which is created during initialization. For abstraction, we must create such object for every environment.


There is an exception class ScilabAbstractEnvironment, which is thrown if some operation in environment or in factory fails. It is caught in ScilabObjectsCPP layer and extracted to char** error message for c-layer. GiwsException::JniException which was handled in ScilabObjectsCPP before abstraction, is rethrown in ScilabJavaEnvironment class.

Next week

Test and fix abstraction in JIMS.

2022-09-08 09:26