Pike Overview
Pike consists of two main subsystems: a conversion cross compiler (pikex) and a runtime Python package (pike) that implements an IDL-like API. Working together these two systems deliver a conversion process that maps IDL functionality to Python, specifically functionality delivered by the NumPy and SciPy (collectively referred to as SciPy) modules.
In general, Pike has support for IDL 4.x language features, currently not implementing IDL Objects or Pointers which were first implemented in IDL 5.0.
Operational Structure
Pike is delivered as a Python package which encapsulates all the functionality needed to translate IDL source code to Python, and execute the results within a SciPy environment.
The PIKE package provides a complete IDL to Python conversion environment. To accomplish this capability, PIKE consists of two sub-systems: The pikex conversion compiler and the Pike runtime Python package.
PikeX
The PikeX (pikex) conversion compiler reads IDL source code and outputs Python source code that maintains the IDL structure and execution logic. PikeX is a terminal command, pikex, that operates in a fashion similar to a standard compiler.
When pikex executes, in performs the following processing stages:
- Indexing – Index all inputs, resolving any unknown routines and detailing routine signatures.
- Parse – Parse the IDL source code, creating an internal syntax tree.
- Optimize – Re-organize the syntax tree to transpose IDL functionality into Python language patterns.
- Output – Write Python code that implements the input IDL functionality.
When completed, pikex will write out the desired Python code as well as the Python specific files, allowing for the conversion code to be use as a standard Python package. Additionally, a PIKE specific descriptor file is written, which provide the ability of the generated Python package to be used as a reference library by future conversion operation.
The Pike Library
The PIKE library (or package in Python terms) provides the runtime environment to support IDL-like execution patterns within Python, as well as an extensive set of IDL routines.
The runtime functions provided by the Pike library are often just wrappers around a SciPy routines. These wrappers convert data structures and calling patterns to the native SciPy format. The extent of these wrappers varies and is proportional to the difference between the IDL function signature and that of the SciPy offering.
In addition to the deliveries functions, the PIKE runtime library provides support for a set of unique IDL runtime features. These features include:
- Variable argument numbers and _EXTRA support
- Common Blocks
- System Variables
- Structures
- Data types and data conversion
- Multiple output variables
In addition to supporting the execution of pikex converted IDL source code, the Pike Library also provides a robust IDL-like API that transforms the Python interactive environment, bringing familiar commands the the IPython command line.
Pike Operation
In general, the conversion of IDL code to Python using Pike follows the process outlined in the preceding graphic. Details of each step are provided in the following sections.
Code Conversion
The code conversion process is performed by the pikex conversion compiler, generating Python code that executes using the Pike runtime library, operating in a SciPy Python environment.
The result of this process is a set of Python files that preserve the structure, logic and operational flow of the original IDL implementation. In addition, the pikex command generates the following files: