next up previous contents
Next: Der Terminaltreiber im Rohdatenmodus Up: Treiberkonzepte unter UNIX Previous: Der Terminaltreiber im kanonischen

Algorithmus zum Lesen von einem Terminal

algorithm terminal_read
{
   if (no data on canonical clist)
   {
      while (no data on raw clist)
      {
         if (tty opened with no delay option)
            return;
         if (tty in raw mode based on timer and timer not active)
            arrange for timer wakeup (callout table);
         sleep (event: data arrives from terminal);
      }

      /* there is data on raw clist */
      if (tty in raw mode)
         copy all data from raw clist to canonical clist;
      else    /* tty is in canonical mode */
      {
         while (characters on raw clist)
         {
            copy one character at a time from raw clist to
                  canonical clist: do erase, kill processing;
            if (char is carriage return or end-of-file)
               break;    /* out of while loop */
         }
      }
   }

   while (characters on canonical clist and read count not satisfied)
      copy from cblocks on canonical clist to user address space;
}


Anke Steuernagel
Thu May 15 18:53:37 MET DST 1997