NAME
idl2pyemb - IDL compiler to Python embedded with C
SYNOPSIS
idl2pyemb [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
idl2pyemb parses the given input file (IDL) and generates :
a set of Python sources : an optional _spec.py and pkg/__init__.py for each package
a include file spec.h
(following the language C mapping rules)
a C spec.c
setup.py
idl2pyemb is a Perl OO application what uses the visitor design pattern. The parser is generated by Parse::Yapp.
idl2pyemb 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 emb1 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.h
cp ../corba.c
cp ../cpyhelper.c
Second, run :
idl2pyemb.pl Calc.idl
Third, create your implementation MyCalc.py which inherits of _Calc.py
from _Calc import *
class MyCalc(Calc):
def Add(self, val1, val2):
...
Fourth, register it in the C main tu_calc.c :
Py_Initialize();
PyRun_SimpleString(
"import PyIDL\n"
"import MyCalc\n"
"PyIDL.Register('IDL:Calc:1.0', MyCalc.MyCalc)\n"
);
...
Py_Finalize();
Fifth, build :
gcc -I/Python24/include *.c /Python24/libs/libpython24.a -o tu_Calc
Sixth, Python install :
python setup.py install
Finally, run the test using the embedded module :
tu_Calc
EXAMPLE 2
Use emb2 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, idl2pyext
COPYRIGHT
(c) 2005 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