  PROCEDURE [INLINE] dfp$assign_entry (starting_position: integer;
        number_of_characters: integer;
    VAR entry_assignment_string {input, output} : string ( * <= dfc$queue_assignment_strng_size);
    VAR entry_assignment: integer);

{
{    This procedure scans the input string for a free entry (one whose value is
{ dfc$free_entry_char), and if a free entry is
{ found sets the found entry in the entry assignment string to be assigned
{ (dfc$assigned_entry_char).
{    The input string must be aligned 0 MOD 8, and the size must be an even number
{ of words. The string will only be scanned from the starting position
{ for number_of_characters.
{ If no free entry is found, zero is returned.
{
    TYPE
      char_set = set of char;

    CONST
      swap_successful = 0;

    VAR
      actual_word: string (8),
      char_index_in_word: integer,
      found_word: string (8),
      found_word_starting_char: integer,
      free_char_set: char_set,
      p_test: ^string (8),
      result: 0 .. 2,
      scan_found_free: boolean,
      swap_in_word: string (8),
      word_index: integer;

    free_char_set := $char_set [dfc$free_entry_char];

  /locate_entry/
    REPEAT
      #SPOIL (entry_assignment_string);
      #scan (free_char_set, entry_assignment_string (starting_position, number_of_characters),
            entry_assignment, scan_found_free);
      IF scan_found_free THEN
        entry_assignment := starting_position + entry_assignment - 1;
      ELSE
        entry_assignment := 0;
        RETURN;
      IFEND;
      found_word_starting_char := ((entry_assignment - 1) DIV 8) * 8 + 1;
      #SPOIL (entry_assignment_string);
      { Required due to cybil bug.
      p_test := ^entry_assignment_string (found_word_starting_char, 8);
      #SPOIL (p_test^);
      osp$fetch_locked_string (p_test^, found_word);
      swap_in_word := found_word;
      word_index := (entry_assignment MOD 8);
      IF word_index = 0 THEN
        word_index := 8;
      IFEND;
      found_word (word_index) := dfc$free_entry_char;
      swap_in_word (word_index) := dfc$assigned_entry_char;
      #SPOIL (entry_assignment_string);
      #SPOIL (p_test^);
      #compare_swap (p_test^, found_word, swap_in_word, actual_word, result);
      #SPOIL (p_test^);
      #SPOIL (entry_assignment_string);
    UNTIL result = swap_successful;
  PROCEND dfp$assign_entry;
?? PUSH (LISTEXT := ON) ??
*copyc dft$entry_type
*copyc dft$cpu_queue
*copyc osp$fetch_locked_string
?? POP ??


