Array Resize

Resizes a bunch of arrays to the same size, of any type, in a single call. Assumes they're defined.
This is handy when displaying arrays, like with AreaList Pro, since the arrays should all be kept the same size.

Here's some example code that resizes all the arrays to ten elements.
Array Text(aName;0)
Array String (14;aInvoiceNumber;0)
Array Date(aInvoiceDate;0)
Array Real(aInvoiceAmount;0)

  ` ArrayResize
  ` Resizes all the arrays passed to the size specified
  ` The big difference between this and SIZE_ARRAY is that multiple arrays work
  ` $1 - New size (if negative, then don't clear)
  ` $2 & up - pointers to the arrays


If ($1>=0)
End if 

$ArrayCount:=Count parameters-1

For ($i;1;$ArrayCount)
  $CurSize:=Size of array($ArrayPtr->)
  If ($Clear)
    If ($CurSize>0)
      DELETE ELEMENT($ArrayPtr->;1;$CurSize)
    End if 
    INSERT ELEMENT($ArrayPtr->;1;$NewSize)
    Case of 
      : ($CurSize>$NewSize)  `Delete extra elements
        DELETE ELEMENT($ArrayPtr->;$NewSize+1;$CurSize-$NewSize)
      : ($CurSize<$NewSize)  ` Insert needed elements.
        INSERT ELEMENT($ArrayPtr->;$CurSize+1;$NewSize-$CurSize)
    End case 
  End if   ` $Clear
End for