SPL to HP C/XL Migration Guide (30231-90001)
2: 4
Procedures
Table 2-7. Procedures
---------------------------------------------------------------------------------------------
| | |
| SPL | HP C/XL Equivalent |
| | |
---------------------------------------------------------------------------------------------
| | |
| An SPL procedure can be passed parameters, | An HP C/XL function can be passed |
| either by reference or by value. | parameters, but always by value. |
| | |
| | Pass-by-reference is emulated by explicitly |
| | passing an address pointer and |
| | dereferencing that pointer within the |
| | function. (Array identifiers
appear
to be |
| | passed by reference; they are passed as |
| | pointers.) |
| | |
---------------------------------------------------------------------------------------------
| | |
| Can declare local variables and reference | Same as SPL. |
| global variables. | |
| | |
---------------------------------------------------------------------------------------------
| | |
| Can return a value. | Same as SPL. |
| | |
---------------------------------------------------------------------------------------------
| | |
| Can call themselves. | Same as SPL. |
| | |
---------------------------------------------------------------------------------------------
| | |
| Can be called from other procedures and | Can be called from other functions and from |
| from the main block. | the main function. |
| | |
---------------------------------------------------------------------------------------------
| | |
| Can contain local subroutines. | Cannot contain nested functions. The |
| | closest HP C/XL equivalent is the #define |
| | macro directive (see "Subroutines" below). |
| | |
---------------------------------------------------------------------------------------------
Subroutines
Table 2-8. Subroutines
---------------------------------------------------------------------------------------------
| | |
| SPL | HP C/XL Equivalent |
| | |
---------------------------------------------------------------------------------------------
| | |
| Can appear within procedures and globally. | No direct equivalent. |
| | |
---------------------------------------------------------------------------------------------
If possible, you should recode SPL subroutines as HP C/XL #define macro
directives, which permit parameters, and result in inline substitution.
Where appropriate (i.e., in functions), limit the scope of a #define
directive with a subsequent #undef directive.
Otherwise, you must recode the SPL subroutine as an HP C/XL independent
function. This can be awkward because variables that were formerly lo-
cal to the procedure and known to the subroutine have to be made avail-
able to the new function. You can make variables available to new