
  PROCEDURE [INLINE] ofp$get_next_avt_index
    (VAR control: oft$msdi_volume_access_control;
     VAR result_index: dmt$active_volume_table_index;
     VAR end_of_table: boolean);

?? PUSH (LISTEXT := ON) ??

{ should we put this into OFM$DESIGNER_SCREENS_R3
{ we could also add an init request (but pass the avt_entries_displayed_p
{ array?)
{ where we could check the VSN sorted list and rebuild it if necessary?
{ or is this more expensive than rebuild it everytime?

    VAR
      avt_index: integer,
      index: integer,
      low_index: integer;

    IF control.sort_option_p^.key = ofc$msdi_lut THEN
      IF control.last_used_index < LOWERBOUND (cmv$logical_unit_table^) THEN
        low_index := LOWERBOUND (cmv$logical_unit_table^);
      ELSE
        low_index := control.last_used_index + 1;
      IFEND;

      FOR index := low_index TO UPPERBOUND (cmv$logical_unit_table^) DO
        IF cmv$logical_unit_table^ [index].configured THEN
          FOR avt_index := LOWERBOUND (dmv$active_volume_table.table_p^)
                TO UPPERBOUND (dmv$active_volume_table.table_p^) DO
            IF (NOT dmv$active_volume_table.table_p^ [avt_index].
                  entry_available) AND (dmv$active_volume_table.
                  table_p^ [avt_index].logical_unit_number = index) THEN
              result_index := avt_index;
              end_of_table := FALSE;
              control.last_used_index := index;
              RETURN; {----->
            IFEND;
          FOREND;
        IFEND;
      FOREND;

    ELSEIF (control.sort_option_p^.key = ofc$msdi_user_defined) AND
          (control.sort_option_p^.entries_p <> NIL) THEN
      IF control.last_used_index < LOWERBOUND (control.sort_option_p^.
            entries_p^) THEN
        low_index := LOWERBOUND (control.sort_option_p^.entries_p^);
      ELSE
        low_index := control.last_used_index + 1;
      IFEND;

      FOR index := low_index TO UPPERBOUND (control.sort_option_p^.entries_p^)
            DO
        avt_index := control.sort_option_p^.entries_p^ [index].avt_index;
        IF NOT dmv$active_volume_table.table_p^ [avt_index].
              entry_available THEN
{what should we do, when the VSN does not match  => ? rebuild the VSN list?
          result_index := avt_index;
          end_of_table := FALSE;
          control.last_used_index := index;
          IF control.avt_entries_displayed_p <> NIL THEN
            control.avt_entries_displayed_p^ [avt_index] := TRUE;
          IFEND;
          RETURN; {----->
        ELSE
{????? rebuild the VSN list?
        IFEND;
      FOREND;

      IF control.avt_entries_displayed_p <> NIL THEN
        FOR index := LOWERBOUND (dmv$active_volume_table.table_p^)
              TO UPPERBOUND (dmv$active_volume_table.table_p^) DO
          IF (NOT dmv$active_volume_table.table_p^ [index].entry_available) AND
                (NOT control.avt_entries_displayed_p^ [index]) THEN
            result_index := index;
            end_of_table := FALSE;
            control.last_used_index := UPPERBOUND (control.sort_option_p^.
                  entries_p^) + 1;
            control.avt_entries_displayed_p^ [index] := TRUE;
            RETURN; {----->
          IFEND;
        FOREND;

      IFEND;
    ELSE {search AVT
      IF control.last_used_index < LOWERBOUND (dmv$active_volume_table.
            table_p^) THEN
        low_index := LOWERBOUND (dmv$active_volume_table.table_p^);
      ELSE
        low_index := control.last_used_index + 1;
      IFEND;

      FOR index := low_index TO UPPERBOUND (dmv$active_volume_table.table_p^)
            DO
        IF NOT dmv$active_volume_table.table_p^ [index].entry_available THEN
          result_index := index;
          end_of_table := FALSE;
          control.last_used_index := index;
          RETURN; {----->
        IFEND;
      FOREND;
    IFEND;
    end_of_table := TRUE;

  PROCEND ofp$get_next_avt_index;

*copyc dmt$active_volume_table_index
*copyc oft$designer_screens_types
?? POP ??
*copyc cmv$logical_unit_table
*copyc dmv$active_volume_table

