Stapel mit Aufträgen II

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

QuickSort.om
PROCEDURE PushJob(first, last: INTEGER);
BEGIN
   ASSERT(top < stacklen);
   jobs[top].first := first;
   jobs[top].last := last;
   INC(top);
END PushJob;

PROCEDURE FetchJob(VAR first, last: INTEGER) : BOOLEAN;
BEGIN
   IF top = 0 THEN RETURN FALSE END;
   DEC(top);
   first := jobs[top].first;
   last := jobs[top].last;
   RETURN TRUE
END FetchJob;

*PushJob übernimmt einen Auftrag und legt ihn ganz oben auf den Stapel.
 
*FetchJob liefert FALSE, falls kein Auftrag mehr vorliegt. Ansonsten wird der Auftrag über die beiden Referenz-Parameter first und last zurückgegeben.
 

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