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

Procedure AllocCont(Var L: CONT);
Begin
	Alias cp: ContPools[cur_node][cur_id] Do
	Alias ptr: cp.pos Do
		Assert (ptr < ContMax)	"No more cont recs left";
		ptr := ptr + 1;
		L := (ptr - 1);
	End;
	End;
End;

Procedure FreeCont(L: CONT);
Begin
	Alias cp: ContPools[cur_node][cur_id] Do
	Alias ptr: cp.pos Do
		Assert (ptr != 0)	"what the hell are you freeing";
		Undefine cp.slots[ptr];
		ptr := ptr - 1;
	End;
	End;
End;

Procedure Save_XpotThread_t0(L:CONT; xt:XpotThread_t);
Begin
	Alias cp: ContPools[cur_node][cur_id] Do
		cp.slots[L].XT0 := xt;
	End;
End;

Procedure Restore_XpotThread_t0(L:CONT; Var xt:XpotThread_t);
Begin
	Alias cp: ContPools[cur_node][cur_id] Do
		xt := cp.slots[L].XT0;
	End;
End; 

Procedure Save_NODE0(L:CONT; n: NODE);
Begin
	Alias cp: ContPools[cur_node][cur_id] Do
		cp.slots[L].NODE0 := n;
	End;
End;

Procedure Restore_NODE0(L:CONT; Var n: NODE);
Begin
	Alias cp: ContPools[cur_node][cur_id] Do
		n := cp.slots[L].NODE0;
	End;
End;

Procedure Save_NODE1(L:CONT; n: NODE);
Begin
	Alias cp: ContPools[cur_node][cur_id] Do
		cp.slots[L].NODE1 := n;
	End;
End;

Procedure Restore_NODE1(L:CONT; Var n: NODE);
Begin
	Alias cp: ContPools[cur_node][cur_id] Do
		n := cp.slots[L].NODE1;
	End;
End;

Procedure Save_NODE2(L:CONT; n: NODE);
Begin
	Alias cp: ContPools[cur_node][cur_id] Do
		cp.slots[L].NODE2 := n;
	End;
End;

Procedure Restore_NODE2(L:CONT; Var n: NODE);
Begin
	Alias cp: ContPools[cur_node][cur_id] Do
		n := cp.slots[L].NODE2;
	End;
End;

Procedure Save_CONT0(L:CONT; n: CONT);
Begin
	Alias cp: ContPools[cur_node][cur_id] Do
		cp.slots[L].CONT0 := n;
	End;
End;

Procedure Restore_CONT0(L:CONT; Var n: CONT);
Begin
	Alias cp: ContPools[cur_node][cur_id] Do
		n := cp.slots[L].CONT0;
	End;
End;

Procedure Save_SHARER_LIST_ITOR0(L:CONT; n: SHARER_LIST_ITOR);
Begin
	Alias cp: ContPools[cur_node][cur_id] Do
		cp.slots[L].SHARER_LIST_ITOR0:= n;
	End;
End;

Procedure Restore_SHARER_LIST_ITOR0(L:CONT; Var n: SHARER_LIST_ITOR);
Begin
	Alias cp: ContPools[cur_node][cur_id] Do
		n := cp.slots[L].SHARER_LIST_ITOR0;
	End;
End;

Procedure SaveFunc(L:CONT; n: FuncType);
Begin
	Alias cp: ContPools[cur_node][cur_id] Do
		cp.slots[L].Func := n;
	End;
End;

Function GetFunc(L:CONT): FuncType;
Begin
	Alias cp: ContPools[cur_node][cur_id] Do
		return cp.slots[L].Func;
	End;
End;
