BEGIN { fresh(About) fresh(Events) fresh(Q) Clock=0 Trace=3 ; verbose trace Trace="/tmp/trace" Report="/tmp/report" Type="type" } BEGIN { Eden=1 Q[Eden]="eden" } function newq(what, tmp) { tmp=++Q[0]; Q[tmp]=what FindQ[what]=tmp return tmp } ; customersarrive -> move to shortest queue ; customer leaves , next customer moves to window with teller function init() { for(i=1;i<=Windows;i++) Window[i]=newq("window") for(i=1;i<=Windows;i++) Window[i]=newq("window") for(i=1;i<=Customers0;i++) exists("customer" i, "customer") for(i=1;i<=Tellors;i++) exists("tellor" i, "tellor") newq("CustomerArrival") newq("CustomerDeparture") newq("TellorsAtBreak") } function push(x,i,new, tmp) { tmp= ++x[i,0]; return x[i,tmp] = new } function pop(x,i, tmp) { tmp= x[i,0]--; return tmp } function place(q,a) { About[x]=q; Q[q,a]=Clock; push(Q,q,a) } function move(a,q1,q2) { delete Q[q,q1]; pop(Q,q); place(q,a2) } function pending(x,when, arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) { knownTime(when); tmp = ++Events[when,0]; Events[when,tmp]=x if (arg1) Events[when,tmp,++Events[when,tmp,0]]=arg1 if (arg2) Events[when,tmp,++Events[when,tmp,0]]=arg2 if (arg3) Events[when,tmp,++Events[when,tmp,0]]=arg3 if (arg4) Events[when,tmp,++Events[when,tmp,0]]=arg4 if (arg5) Events[when,tmp,++Events[when,tmp,0]]=arg5 } function knownTime(x) { while (x > Events[0]) ++Events[0] } function exist(name,type, new) { if (a in About) { if Isa(a) == type { return message(b(a) " already exists"); } else { return error(b(a) " of type " b(Isa(a)) " cannot be changed to " b(type)) } } new = ++Abouts Isa(new) = type At(new) = Eden What(new) = name return new } function fresh(array) { split("",array,"") } function b(str) { return "[" str "]" } function message(str) { trace(Verbsoe > 2, "Message: ",str) } function warning(str) { trace(Verbsoe > 1, "Warning: ",str) } function error(str) { trace(1, , "Error: ",str) ; exit; } function trace(test,prefix,str) { if (test) print prefix,str>Trace }