//IfsLeafRes.bcpl - Leaf server - RESIDENT
// Copyright Xerox Corporation 1979

//Last modified November 12, 1980  2:06 PM, by Wobber
//Last modified June 20, 1979  10:23 AM by Taft

get "IfsRs.decl";
get "IfsSequin.decl";

external
[
//outgoing procedures
LeafEvent;

//incoming procedures
CreateJob; HandleLeafRejection; LeafCtx; QueueEvent;

//incoming statics
leafEnabled; scb; socLeaf;
]

//---------------------------------------------------------------------------
let LeafEvent(ecb) be
//---------------------------------------------------------------------------
//If the Leaf-Sequin context is not active, check the Leaf
// socket input queue for Pups every 100 ms.
[
if scb>>SCB.leafCtx eq 0 & socLeaf>>PupSoc.iQ.head ne 0 then
   [
   if leafEnabled then scb>>SCB.leafCtx = CreateJob(LeafCtx, jobTypeLeaf);
   if scb>>SCB.leafCtx eq 0 then HandleLeafRejection();
   ]
QueueEvent(ecb, leafEventInterval);
]