Guardian Procedure Calls Reference Manual (G06.25+)
Guardian Procedure Calls (H-K)
Guardian Procedure Calls Reference Manual—522629-013
7-9
HEAPSORTX_ Procedure
indicates the outcome of the operation. It returns one of the following values:
0 Array has been successfully sorted.
29 Required parameter is missing.
590 Invalid parameter supplied.
632 Insufficient stack space for temporary variable (see “Considerations”).
array input, output
INT .EXT:ref:*
contains equal-sized elements to be sorted.
num-elements input
INT(32):value
is the number of elements in 
array.
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.










