Macro: GLOBAL$ARRAY

Module location: FMAC line 12550 (view source)

  #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
  ARRAY_DIM_SIZE_HELPER !2 !3 !4 !5 !6 !7 !8 !9 //Push the size of each dimension

  #PUSH !g
  #DTYPE G$ !1
  #IF (!g=19)
    #PUSH !h
    #STRG H$ !1
    #DPUSH |CI!h
    #DPUSH |CI19
    #DPUSH |CI!q //Push the number of dimensions
    #ARRV V$
    #SPUSH
    #DTSYM !1  // moves datatype Letter ID into !$
    ARRAY_GLOBAL_VARIABLE_REPLACE_HELPER !2 !3 !4 !5 !6 !7 !8 !9
    #SPOP
    #POP H$
  #ELSE
    #DPUSH |CI!g //Push the element type
    #DPUSH |CI!q //Push the number of dimensions
    #ARRV V$
    #SPUSH
    #DTSYM !1  // moves datatype Letter ID into !$
    ARRAY_GLOBAL_VARIABLE_REPLACE_HELPER !2 !3 !4 !5 !6 !7 !8 !9
    #SPOP
  #ENDIF
  #POP G$

  // 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)
      Global$Array !1 !2 !4 !5 !6 !7 !8 !9
    #ENDIF
  #ENDIF