USG_PG3/usr/source/lexgen1/anoth.c
# include "../lexgen1/ldefs.c"
# define table(i,c) ((pp=move(i,c,1,0)) ? pp[1] : 0)
another()
{
int act[NCH], *pp, c, i, j, im, m, max, uother[NST], *ntrans;
ntrans = uother;
for(i=0; i<=nstate; i++)
uother[i] = 0;
for(i=0; i<=nstate; i++)
if (used[i] && (j=other[i]))
uother[j] = 1;
for(i=0; i<= nstate; i++)
{
if (used[i]==0 || other[i] != 0 || uother[i] != 0)
continue;
im = max = 0;
for(c=0; c<NCH; c++)
act[c] = ((pp=move(i,c,1,0)) ? pp[1] : 0);
for(j=0; j<i; j++)
{
if (used[j]==0) continue;
m = common(act,j);
if (m>max && check(act,j)) {max=m; im=j;}
}
if (im>0)
{
for(c=0; c<NCH; c++)
{
if (act[c] != 0)
if (act[c] == ((pp=move(im,c,1,0)) ? pp[1] : 0))
move(i,c,-1, 0);
}
other[i] = im;
uother[im] = 1;
}
}
for(i=j=1; i<= nstate; i++)
{
if (used[i]==0) continue;
other[j++] = used[other[i]];
}
}