Guardian Procedure Calls Reference Manual

size-of-element
input
INT:value
is the size, in words, of each element in array.
compare-proc
input
INT PROC
is an application-supplied function procedure that HEAPSORTX_ calls to compare two array
elements and determine their sorted order. The addresses of these elements are supplied as
parameters to compare-proc.
This procedure must be of the form:
INT PROC compare-proc ( element-a , element-b );
INT .EXT element-a;
INT .EXT element-b;
The compare-proc must compare element-a with element-b and return a result. It must
return zero (false) if element-b should precede element-a; it must return a nonzero value
(true) if element-a should precede element-b.
pointer-array
input
INT(32) .EXT:ref:*
provides space for an array that is used to optimize the sort. The size of each element in the
array is an INT(32), and the number of elements is equal to the value specified for the
num-elements parameter. You do not need to supply any data in the array, nor should you
expect any useful data in the array on return. The value that you supply is simply a pointer to
an area that has been allocated by your program that is of sufficient size for the array. The
array is used as a work area by the sort.
If this parameter is specified, and not equal to 0D, the sort builds an array of pointers in the
area supplied by this parameter. It is these pointers that are rearranged as the sort progresses.
Only when the sort is complete is the actual data supplied in the array parameter rearranged.
If this parameter is omitted or specified as 0D, the sort works directly on the data supplied in
the array parameter. Supplying this parameter can substantially improve the performance of
the sort, especially if there is a large number of elements or a large element size.
Returned Value
INT
Outcome of the call:
Array has been successfully sorted.0
Required parameter is missing.29
Invalid parameter supplied.590
Insufficient stack space for temporary variable (see Considerations).632
Considerations
In addition to its local variables, HEAPSORTX_ allocates stack space equal to the value you
specify as the size of one array element. If insufficient stack space is available, HEAPSORTX_
returns an error 632.
696 Guardian Procedure Calls (H-K)