SPL to HP C/XL Migration Guide (30231-90001)

11-1
Chapter 11 Step-by-Step SPL HP C/XL Conversion
This chapter describes a suggested method for converting SPL programs
into HP C/XL. It is by no means the only method, but it is one that works
well in a number of common circumstances. The person assigned to the
conversion should have a good working knowledge of SPL and the tools
(that is, editors) that are used to maintain SPL programs. That person
should also be acquainted with the C programming language. The SPL
program being converted should be currently correct, and there should be
a method of testing it for continued correct behavior.
It is preferable to convert an SPL program in a series of steps, actually
retaining the program in SPL source for as long as possible. The primary
steps are:
1. Remove as many of the hardware-dependent SPL constructs as
possible from the SPL version, recompile, and test.
2. Rewrite certain SPL constructs to be more like HP C/XL, recompile,
and test.
3. Convert the source code to HP C/XL (rewriting as little as
possible), then compile, debug, and test.
4. Examine the HP C/XL source for improvements that can take
advantage of constructs and capabilities not available in SPL.
Step One: Remove Hardware Dependencies
Many SPL constructs are highly hardware-dependent, such as ASSEMBLE
statements and references to hardware registers. In most cases, these
constructs were used by SPL programmers for reasons of efficiency, not
for lack of higher level alternatives. Rewriting these portions and
testing the program again should be a first step. Normally, this is a
matter of determining exactly what the old statements are intended to
do, and implementing the same function in SPL statements that do not
dependon specific hardware instructions or registers.
The direct use of the stack, via PUSH, DEL, and TOS operators is done for
one of two reasons: either to avoid declaring temporary variables, or to
retrieve information left on the stack after an operation such as SCAN.
In the first case, simply declaring extra variables will allow the stack
references to be eliminated. In the case of operations such as SCAN, see
the relevant areas of this guide for SPL procedures that isolate these
operations and may later be replaced by equivalent HP C/XL functions.