/*
 * Copyright (c) 1996 by Satish Chandra, Brad Richards, Mark D. Hill, 
 * James R. Larus, and David A. Wood.
 *
 * Teapot is distributed under the following conditions:
 * 
 *     You may make copies of Teapot for your own use and modify those copies.
 * 
 *     All copies of Teapot must retain our names and copyright notice.
 * 
 *     You may not sell Teapot or distributed Teapot in conjunction with a
 *     commercial product or service without the expressed written consent of
 *     the copyright holders.
 * 
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 * 
 */

Function Q_Empty(Var info: INFO):boolean;
Begin
	Alias Queue : info.Queue Do
		If (Queue.Count = 0) Then
			return true;
		Else
			return false;
		End;
	End; -- alias Queue
End;

Procedure Q_ProcessHead(id:ID; Var info: INFO);
Var
	Msg : Message;
	Src : NODE;
	i: 0..QueueMax;
Begin
	Alias Queue : info.Queue Do
		If (Queue.Count > 0) Then
			Msg := Queue.Elems[0].Msg;
			cur_msg := Msg;
			cur_id := id;
			Src := Queue.Elems[0].Src;
			For i:= 0 to Queue.Count - 2 Do
				Queue.Elems[i] := Queue.Elems[i+1];
			End;
			Undefine Queue.Elems[Queue.Count - 1];
			Queue.Count := Queue.Count - 1;
			DispatchState(info.State, Msg.MType, Msg.Addr, info, Src);
		End;
	End;
End;
