/*
 * 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.
 * 
 */

-----------------------------------------------------------------------------
--							Queue mgmt
-----------------------------------------------------------------------------


Procedure Q_Enqueue(Self_Id, Src:NODE; Msg:Message);
Begin
	Alias Me : Nodes[Self_Id] Do
	Alias Blk : Me.Dram[Msg.Addr] Do
	Alias Queue : Blk.Queue Do
		Assert (Queue.Count != QueueMax) "Queue full\n";
		Queue.Elems[Queue.Count].Msg := Msg;
		Queue.Elems[Queue.Count].Src := Src;
		Queue.Count := Queue.Count + 1;
	End; -- alias Queue
	End; -- alias Blk
	End; -- alias Me
End;

Procedure Enqueue(m_tag : MSG; id : ID; Var info: INFO; src: NODE);
Var
	msg: Message;
Begin
	msg.MType := m_tag;
	msg.Addr := id;
	If (!Isundefined(cur_msg.Value)) Then
	    -- msg.Value := cur_msg.Value;
	    Assert (false) "Data message being enqueue!!\n";
	Endif;
	Q_Enqueue(cur_node, src, msg);
End;
