NAME
idl2pyext - IDL compiler to Python extension with C
SYNOPSIS
idl2pyext [options] spec.idl
OPTIONS
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 :
- -h
-
Display help.
- -i directory
-
Specify a path for import (only for version 3.0).
- -J directory
-
Specify a path for Python package.
- -O
-
Enable old Python object model.
- -v
-
Display version.
- -x
-
Enable export (only for version 3.0).
DESCRIPTION
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/>.
INSTALLATION
After standard Perl installation, you must install the Python package PyIDL :
setup.py install
And copy the file corba.h in Python24/include.
TUTORIAL
EXAMPLE 1
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
EXAMPLE 2
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.
SEE ALSO
cpp, idl2html, idl2py, idl2pyemb
COPYRIGHT
(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.
AUTHOR
Francois PERRAD, francois.perrad@gadz.org