USG_PG3/usr/source/lexgen2/outstp.c

# include "../lexgen1/ldefs.c"
outstp(pstop, vstop)
	int *pstop, *vstop;
{
int i, ns, j2, j, *pp, k;
for(i=0; i<=nstate; i++)
	pstop[i] = 0;
ns = 1;
for(i=0; i<=nstate; i++)
	if ((k=used[i]) && (pp=stops(i,1)))
		{
		j2= oldstop(pp,i);
		if (j2)
			pstop[k] = pstop[used[j2]];
		else
			{
			pstop[k] = ns;
			while (vstop[ns++] = *pp++);
			}
		}

if (ratfor)
	rprint(vstop, "vstop", ns);
else
	{
	printf(output, "int %svstop[] {\n",label);
	for(i=0;i<ns; i++)
		printf(output,"%d,\n",vstop[i]);
	printf(output, "0};\n");
	}
}

oldstop (this, n)
	int *this;
{
/* is this the same as an earlier stop */
int i, v, *q, *p;
for(i=0; i<n; i++)
	{
	q = this;
	if ((used[i]) && (p=stops(i,1)))
	while ( (v= *p++) == *q++)
		if (v== 0)
			return(i);
	}
return(0);
}