idl2pyext - IDL compiler to Python extension with C
idl2pyext [options] spec.idl
All options are forwarded to C preprocessor, except -h -i -J -v -x.
With the GNU C Compatible Compiler Processor, useful options are :
Specific options :
Display help.
Specify a path for import (only for version 3.0).
Specify a path for Python package.
Enable old Python object model.
Display version.
Enable export (only for version 3.0).
idl2pyext parses the given input file (IDL) and generates :
a set of Python sources : an optional _spec.py and pkg/__init__.py for each package (in a standard tree)
a C c_pkgmodule.c for each package
a include file hpy_spec.h
a include file spec.h
(following the language C mapping rules)
a C skeleton spec.c (with automatic merge)
setup.py
idl2pyext is a Perl OO application what uses the visitor design pattern. The parser is generated by Parse::Yapp.
idl2pyext needs a cpp executable.
CORBA Specifications, including IDL (Interface Language Definition) C Language Mapping and Python Language Mapping are available on <http://www.omg.org/>.
After standard Perl installation, you must install the Python package PyIDL :
setup.py install
And copy the file corba.h in Python24/include.
Use ext1 as current directory.
The file Calc.idl describes the interface of a simple calculator.
Nota : the IDL interface Calc is in the global scope.
First, copy additional files in current directory
cp ../corba/corba.h cp ../corba/corba.c cp ../corba/cpyhelper.c
Second, run :
idl2pyext Calc.idl
Third, in Calc.c complete each methode between tag START_EDIT and STOP_EDIT :
// IDL : long Add(in long val1, in long val2); CORBA_long Calc_Add( Calc _o, CORBA_long val1, // in (fixed length) CORBA_long val2, // in (fixed length) CORBA_Environment * _ev ) { /* START_EDIT (Calc_Add) */ return val1 + val2; /* STOP_EDIT (Calc_Add) */ }
Fourth, build :
python setup.py build install
Finally, run Unit Test using the extension module :
python tu_Calc.py
Use ext2 as current directory.
The file CalcCplx.idl describes the interface of a complex calculator.
Nota : the IDL interface CalcCplx is in the IDL module Cplx.
Same steps as in previous example.
cpp, idl2html, idl2py, idl2pyemb
(c) 2005-2007 Francois PERRAD, France. All rights reserved.
This program and all CORBA::Perl modules are distributed under the terms of the Artistic Licence.
Francois PERRAD, francois.perrad@gadz.org
To install CORBA::Python, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CORBA::Python
CPAN shell
perl -MCPAN -e shell install CORBA::Python
For more information on module installation, please visit the detailed CPAN module installation guide.