SPL to HP C/XL Migration Guide (30231-90001)
1-1
HP C/XL is a highly portable version of the C language.
SPL programs that rarely use machine-dependent constructs are easy to
translate to HP C/XL. Consequently, the first step in any SPL to HP C/XL
conversion is to isolate, and, if possible, eliminate the use of
machine-dependent SPL features. Machine-dependent SPL features include
direct reference to hardware registers, assembly instructions, and
explicit stack manipulation. Many of these operations are used to
optimize the MPE V environment and can be easily rewritten in higher
level SPL constructs that can be converted directly to HP C/XL.
Machine-dependent SPL features allow access to extra data segments to
overcome the limited address space on MPE V machines. This restriction
is not present in MPE XL, so these routines may be simplified or
eliminated. Such changes can be made (but not tested) in the MPE V
environment.
SPL programs sometimes rely upon the hardware stack environment of MPE V
machines. MPE XL machines do not have hardware stacks. Although you
could emulate a stack in software, using HP C/XL constructs and data
structures, usually the better choice is to redesign the algorithm and
rewrite the affected program.
Some high-level SPL constructs can be rewritten using alternative SPL
operations that are easier to translate into HP C/XL. For example, SPL
allows subroutines to be local to procedures. Although HP C/XL does
allow nested blocks (compound statements with local data), HP C/XL does
not allow any nesting of functions. Rewriting an SPL program to
eliminate subroutines, either by placing the code inline, or by
converting the SPL subroutine into an SPL procedure, will allow direct
translation of the program structure into HP C/XL.
Conversion Strategy
This guide describes a four-step procedure for converting an SPL program
to HP C/XL:
1. Remove as many hardware-dependent SPL constructs as possible from
the SPL program. Recompile and test.
2. Rewrite other SPL constructs into forms that convert easily to HP
C/XL. Recompile and test.
3. Convert the SPL source code to HP C/XL source code, rewriting as
little as possible. Compile and test.
4. Make improvements in the HP C/XL source code.
This procedure is described in detail in Chapter 11.
For large programs, you may consider a phased migration. You could
convert the main program first and use the switch subsystem to access the