Macro: LOCAL$ARRAY
#DATA
#SET Q$ 0
ARRAY_DIM_COUNT_HELPER !2 !3 !4 !5 !6 !7 !8 !9 // sets !q to num of dims
#PUSH !q // we need this a bit later
#DPUSH |CI!q //Push the number of dimensions
#PUSH !g
#DTYPE G$ !1
#IF (!g=19)
#PUSH !h
#STRG H$ !1
#SPUSH
#DTSYM !1 // moves datatype Letter ID into !$
ARRAY_LOCAL_VARIABLE_REPLACE_HELPER !2 !3 !4 !5 !6 !7 !8 !9
#SPOP
#DPUSH |CI19
#DPUSH |CI!h
#POP H$
#ELSE
#PUSH !g
#SPUSH
#DTSYM !1 // moves datatype Letter ID into !$
ARRAY_LOCAL_VARIABLE_REPLACE_HELPER !2 !3 !4 !5 !6 !7 !8 !9
#SPOP
#POP G$
#DPUSH |CI!g //Push the element type
#ENDIF
#POP G$
ARRAY_DIM_SIZE_HELPER !2 !3 !4 !5 !6 !7 !8 !9 //Push the size of each dimension
ARRAY_INIT_HELPER !2 !3 !4 !5 !6 !7 !8 !9
// at the moment only support multiple array variables with single dimension arrays
// e.g. "integer[] i1 i2" is allowed, "integer[][] i1 i2" is not allowed.
// this limit was created because it will be very difficult to make fmac do this and this should be a rare occurance.
#POP Q$ // number of dimensions
#IF (!q>1) // if more than one dimension
#IF (!0>(!q+2)) // num of params must be num of dimensions plus 2
#ERROR DFERR_COMP_ILLEGAL_CODE_PLACEMENT 'Multi Dimensional array variables must be defined one per line'
#ENDIF
#ELSE
#IF (!0>3)
LOCAL$ARRAY !1 !2 !4 !5 !6 !7 !8 !9
#ENDIF
#ENDIF