Filter für die Historie II

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]

VirtualTour.om
PROCEDURE ProcessCommand;
   VAR
      ch1, ch2: CHAR;
      index1, index2: INTEGER;
      currentPos: Streams.Count;
      len: Streams.Count; ok: BOOLEAN;
   (* ... *)
BEGIN (* ProcessCommand *)
   Streams.GetPos(history, currentPos);
   ch1 := line[1]; ch2 := line[2];
   IF (ch1 >= "a") & (ch1 <= "z") THEN
      index1 := ORD(ch1) - ORD("a");
      IF ch2 = 0X THEN
         marks[index1] := currentPos;
      ELSIF (ch2 >= "a") & (ch2 <= "z") THEN
         index2 := ORD(ch2) - ORD("a");
         IF (marks[index1] >= 0) &
               (marks[index2] > marks[index1]) THEN
            len := marks[index2] - marks[index1];
            Write.String("*** copying "); Write.Int(len, 1);
            Write.Line(" bytes from history:");
            Streams.SetPos(history, marks[index1]);
            ok := Streams.Copy(history, out, len);
            ASSERT(ok);
            Write.Line("*** copying finished");
            Streams.SetPos(history, currentPos);
         ELSE
            Write.Line("Invalid range!");
         END;
      ELSE Help;
      END;
   ELSE Help;
   END;
END ProcessCommand;

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]
Copyright © 2004, 2005 Andreas Borchert, in HTML konvertiert am 18.02.2005