High-level programming languages boost a development efficiency by providing a fast prototyping and a fast idea-write-test cycle. The GetReuse SDK functionality is ready to use with programming languages Perl and Python, and a fast creation of bindings for other programming languages is possible due to the SWIG interface.
The GetReuse SDK distribution contains:
Already compiled modules for the Active Perl 5.6 and the Windows Python 2.3
Sample Perl and Python programs
Make-files for a compilation or a recompilation of bindings
The SWIG interface definition for a creation of other programming languages bindings
Perl binding files are located in the folder bindings/perl.
The already compiled module for the Active Perl 5.6 is located in the folder win32mingw. You can get Active Perl at the http://www.activestate.com/Solutions/Programmer/Perl.plex.
Under Linux you have to compile a Perl module youself by running the command make. After the successfull compilation you get module files in the folder linux586. A Perl development package and other development packages should be installed for the compilation.
Functions of the Perl module follow functions of the C library.
The correspondence between C names and Perl names
| C name | Perl name |
|---|---|
| gr_registered_to | registeredTo |
| gr_error | error |
| gr_measure | measure |
| gr_adjust | adjust |
The sample program distcalc.pl is located in the folder examples/perl in the GetReuse SDK distribution. This program is a rewrite of the program distcalc.c in the Perl programming languages.
The Perl interpreter should know a location of the the module files in order to load the module. The simplest solution is to copy the module files into the same folder where the Perl program is located. A better solution is to specify a path to the module folder using the parameter -I of the Perl interpreter. For example:
perl -I../../bindings/perl/win32mingw distcalc.pl Makefile distcalc.pl
Perl binding files are located in the folder bindings/python.
The already compiled module for the Windows Python 2.3 is located in the folder win32mingw. You can get Windows Python at the http://python.org/download/.
Under Linux you have to compile a Python module youself by running the command make. After the successfull compilation you get module files in the folder linux586. A Python development package and other development packages should be installed for the compilation.
Functions of the Python module follow functions of the C library.
The correspondence between C names and Python names
| C name | Python name |
|---|---|
| gr_registered_to | registeredTo |
| gr_error | error |
| gr_measure | measure |
| gr_adjust | adjust |
In the Python binding the constant INFINITE_DISTANCE is useless. It is so because in a case of an error the module code raises an exeption instead of returning the special value.
The sample program distcalc.py is located in the folder examples/python in the GetReuse SDK distribution. This program is a rewrite of the program distcalc.c in the Python programming languages.
The Python interpreter should know a location of the the module files in order to load the module. The simplest solution is to copy the module files into the same folder where the Python program is located. Alternate solution is to pass a path to the folder as a parameter into the Python program. The Python program can update the system variable sys.path of the Python interpreter and then import the module. This approach is used by the sample program distcalc.py. You can run the program, for example, so:
GETREUSE_MODULE_DIR=../../bindings/python/win32mingw \ python distcalc.py Makefile distcalc.py
It is supposed that you will not compile bindings by yourself, so details of the process are not described and only the high-level overview is given.
Development of the GetReuse SDK goes under Linux. The compiler is the gcc compiler. Under Microsoft Windows the gcc is used in the MinGW environment.
If you plan to recompile bindings under Microsoft Windows you should install MinGW and setup an environment in the file include/platform.mk.
Bindings are created using SWIG. SWIG is a software development tool that connects programs written in C with a variety of high-level programming languages.
A SWIG interface file is the file include/getreuse.swg. The code of Perl and Python bindings is automatically generated from the SWIG interface file.
© 2003, 2004 DataHansa software. All rights reserved.
All registered names are the property of their respective owners.