Guardian Procedure Calls Reference Manual

compare-proc
input
INT PROC
is an application-supplied function procedure that HEAPSORT calls to determine the sorted
order (ascending or descending) of the elements in array.
This procedure must be of the form:
INT PROC compare-proc ( element-a, element-b );
INT .element-a;
INT .element-b;
The compare-proc must compare element-a with element-b and return either of these
values:
(indicating false) if element-b should precede element-a.0
(indicating true) if element-a should precede element-b.1
element-a and element-b are INT:ref parameters.
Considerations
In addition to its local variables, HEAPSORT allocates stack space equal to the value you
specify as the size of one array element. If insufficient stack space is available, the call to
HEAPSORT fails: a TNS Guardian process gets a stack overflow trap; an OSS or native process
receives a SIGSTK signal.
Example
In the following example, HEAPSORT sorts the elements in array in ascending order:
CALL HEAPSORT ( array, num^elements, element^size,
ascending );
694 Guardian Procedure Calls (H-K)