
  PROCEDURE [INLINE] rap$sort_cycles
    (    cycles_p: pft$p_cycle_array);

?? PUSH (LISTEXT := ON) ??

    VAR
      current: integer,
      gap: integer,
      start: integer,
      swap: pft$cycle_array_entry;


    gap := UPPERBOUND (cycles_p^);
    WHILE gap > 1 DO
      gap := 2 * (gap DIV 4) + 1;
      FOR start := LOWERBOUND (cycles_p^) TO UPPERBOUND (cycles_p^) - gap DO
        current := start;
        WHILE (current > 0) AND (cycles_p^ [current].cycle_number < cycles_p^ [current + gap].cycle_number) DO
          swap := cycles_p^ [current];
          cycles_p^ [current] := cycles_p^ [current + gap];
          cycles_p^ [current + gap] := swap;
          current := current - gap;
        WHILEND;
      FOREND;
    WHILEND;

  PROCEND rap$sort_cycles;

{ PURPOSE:
{   This procedure sorts the cycles of a permanent file
{   in descending order.
{
{ DESIGN:
{   This procedure uses a shell sort technique.
{
{ NOTES:
{

*copyc pft$p_cycle_array
?? POP ??

