The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information.... |
Home ![]() ![]() ![]() ![]() |
|||||||||||||||
See also: SortIntoArray, SortArray, TVarKind | |||||||||||||||
InsertIntoArray |
|||||||||||||||
The routine InsertIntoArray supports the insertion of a new element into a linear array. This routine requires the address, the type, and the value of the new element, the length of the array, and the position where the new element should be inserted. InsertIntoArray shifts all elements from the position index one item back and stores the new element in the freed position. The last element of an array will be lost during this action. The parameter ArrayAdr holds a pointer to the array (use the operator @). The parameter LengArray defines the length of this array (i.e. the maximum number of elements of this array). The parameter LengArray may be defined smaller than the actual size of the array. In this case only the first LengArray elements are processed by InsertIntoArray. The parameter TypArray defines the type of the array elements. The users should be aware that a wrong designation of the type of the array elements leads to severe errors and can cause a system crash. The following types are valid: inum (integer), lnum (longint), snum (single), dnum (double), and rnum (real); the types strg (string) and bool (boolean) are not supported. As an alternative to version [1] you may use the simpler versions [2], [3], and [4] for integer, single, or double precision arrays, respectively. Version [1] is only available for the Win32 environment, but not for .NET. The parameter SArray is an open array of integer, single, or double precision values. In version [1] of InsertIntoArray the pointer value holds the address of the variable whose value should be inserted. This variable has to be of the same type as the elements of the array. For the other versions value contains the value to be inserted. The parameter index specifies the position where to insert the value. If index is larger than LengArray (or High(SArray) in the case of versions [2]..[4]) the new value is not inserted at all. Please note that the array is assumed to be indexed from 1 to LengArray in version [1], and from 0 to High(SArray) for versions [2]..[4]. Thus the parameter index may assume values between 1 and LengArray for version [1], and values between 0 and High(SArray) for the other versions.
|