SPL to HP C/XL Migration Guide (30231-90001)
8- 12
Array Format 2: Bounded Indirect Variable Array.
---------------------------------------------------------------------------------------------
|||
| SPL | HP C/XL Equivalent |
|||
---------------------------------------------------------------------------------------------
|||
| | No direct equivalent. |
| INTEGER ARRAY ABC ( LOW'VAR : HIGH'VAR ) | |
| This is an SPL "indirect" array with | Dynamic arrays are not allowed, but there |
| variable bounds. The bounds are evaluated | are library routines, such as malloc, to |
| each time the procedure is called, and | allocate memory dynamically and assign an |
| storage is allocated accordingly. | address to an array name. See the
HP C/XL
|
||
Library Reference Manual
for details. |
|||
---------------------------------------------------------------------------------------------
Array Format 10: Bounded Direct Constant Array.
---------------------------------------------------------------------------------------------
| | |
| SPL | HP C/XL Equivalent |
| | |
---------------------------------------------------------------------------------------------
| | |
| | |
| REAL ARRAY ABC(0:9) = PB | static float ABC [10] |
| := 1,2,3,4,5,6,7,8,9,10; | = {1,2,3,4,5,6,7,8,9,10}; |
| This is a "constant" array. It is | This is not an exact equivalent. There is |
| initialized in the code segment and cannot | no protection against inadvertent |
| not be modified. | modification. |
| | |
---------------------------------------------------------------------------------------------
OWN Local Arrays.
Table 8-13. OWN Local Arrays
---------------------------------------------------------------------------------------------
|| |
| SPL | HP C/XL Equivalent |
|| |
---------------------------------------------------------------------------------------------
|| |
|
own-array-declaration
:|
static-array-declaration
:|
|| |
| OWN [
type
] ARRAY | 1 with
lower
=0. |
|| |
|[
own-array-decl
,] [...] | static [
type
]
array-id "
[
" cells "
]
"
;|
|| |
|
init-own-array-decl
;| |
| | 1 with
lower
<> 0. |
|| |
|
own-array-decl
: | static [
type
]
array-ref "
[
" cells "
]
"
|
|| |
|1.
array-id
(
lower
:
upper
)| |
| | static [
type
]*
array-id
|
|| |
|
init-own-array-decl
:|=&
array-ref "
[
" index "
]
"
;|
|| |
|2.
array-id
(
lower
:
upper
)| |
| | 2 with
lower
=0. |
|:=
value-group
[,...] | |
| | static [
type
]
array-id "
[
" cells "
]
" init
;|
|| |
|
value-group
:| |
| | 2 with
lower
<> 0. |
|{
initial-value
||
|
repeat-factor
(
initial-value
[,...] )}| static [
type
]
array-ref "
[
" cells"
]
"init
:|
|| |
|| |