User:Dlobato
From jderobot
Contents |
2010
Master project
2009
Jderobot project
Multilanguage interoperability in jderobot environment: A low-level approach
This low level approach tries to make jderobot interoperable with other programming languages (Python,Java,...) using a swig [1] wrapper around the platform. Detailed explanation will be written on a TR.
The main problem to address is the massive use of pointers (data and callbacks) jderobot does. They aren't easily wrapped with swig, so it is needed to work on main data structures interchanged between schemas. We can address it in two ways: the hard way, changing nothing in jderobot, and the easy way adding some code to jderobot.
The hard way
This way tries to wrap jderobot as it is, without to change the current API. This requires to wrap C pointers and callbacks.
The easy way
This way needs to add some extra code to jderobot framework to do the wrapping easier. The main idea is to implement interfaces that hides the complexity of managing low level pointers and callbacks. This also will provide an enhanced API to future 4.4 version.
Multilanguage interoperability in jdec environment: A high-level approach
Autoloading modules
Current jderobot implementation loads modules using dl library and then it searchs known symbol names get the implemented driver/schema. This way jderobot have to know or to guess all the needed symbols.
Another way to address the load mechanism is to use construction/initialization mechanism when loading, so the module will autoload by itself. In C++ is easy to do, we can simply initialize a variable using a function calling some module registering function the API provides. It would be something like this:
#include <module.h> ... /*more includes*/ ... ... int loaded = load_module(&modude);
But C forbids initialization from non-constant values:
gcc -ggdb -c mod1.c mod1.c:9: error: initializer element is not constant
So we can't use this mechanism.Luckily,gcc has a useful feature called function attributes [2] that allows to add some attributes to our functions. One of this attributes is constructor that makes a function to be called automatically before execution enters main (). This will make a dlopened module to execute this function intermediately after loading. It would be something like this:
#include <jde.h>
...
/*more includes*/
...
/*mymodule code*/
...
...
__attribute__((constructor)) void loadme() {
jde_load(...);
}
This mechanism could make jderobot loading system more robust and flexible. An example can be found here [3].
2008
Jderobot project
Autotools
Jderobot project now is managed with GNU build system [4]. This will help us in checking software dependencies and configuration (autoconf), and in the automatic generation of compilation rules (automake).
Now to build full project is as simple as:
$> ./configure --prefix=<install-path> $> make $> make install
It allows to configure the compilation rules as well, adding some parameters like required software paths, enable/disable switches for conditional compilation (schemas/drivers) or compilation flags.
2005
Graduate project
jde+: an object oriented implementation of JDE

