3static int ChkXlist(xlist *xt,
6 return (xt->port[ind]==xt->idep);
9static void XtClear(xlist *xt)
19 for (i=0; i<xt->idep; i++)
22 for (i=0; i<sze; i++) {
37 r=(xlist*) calloc(1,
sizeof(xlist));
38 if (!r) ExitProc(OutOfSpc,info);
46 ierr=iAlloc(most+1,info,&r->head);
if(ierr)
return 1;
47 ierr=iAlloc(last,info,&r->port);
if(ierr)
return 1;
48 ierr=iAlloc(last,info,&r->fwrd);
if(ierr)
return 1;
49 ierr=iAlloc(last,info,&r->bwrd);
if(ierr)
return 1;
57void XtFree(xlist **xt)
75 int t,last=xt->last,most=xt->most,
81 if (xt->fwrd[xt->cure]!=last)
82 xt->cure=xt->fwrd[xt->cure];
87 for(t=xt->port[xt->cure]+1; t<=most && head[t]==last; ++t);
103 if (!ChkXlist(xt,e)) {
106 ExitProc(SysError,NULL);
118 xt->port[e]=xt->idep;
120 if (xt->bwrd[e]!=xt->last)
121 xt->fwrd[xt->bwrd[e]]=xt->fwrd[e];
123 xt->head[p]=xt->fwrd[e];
125 if (xt->fwrd[e]!=xt->last)
126 xt->bwrd[xt->fwrd[e]]=xt->bwrd[e];
128 if (xt->head[p]==xt->last &&
132 for(++p; p<=xt->most; ++p){
133 if (xt->head[p]!=xt->last){
147 if (0<=e && e<xt->last && 0<=p && p<=xt->most) {
151 xt->fwrd[e] =xt->head[p];
152 xt->bwrd[e]=xt->last;
154 if (xt->head[p]!=xt->last)
155 xt->bwrd[xt->head[p]]=e;
158 xt->lowp =min(p,xt->lowp);
162 ExitProc(SysError,NULL);
165int XtLeast(xlist *xt)
167 if (xt->lowp==xt->idep) {
169 ExitProc(SysError,NULL);
177 ExitProc(SysError,NULL);
179 xt->cure=xt->head[xt->lowp];
188 if (xt->cure>xt->last)
189 ExitProc(SysError,NULL);
191 if (xt->cure==xt->last)