xref: /csrg-svn/old/tbl/tc.c (revision 11038)
1 /*	tc.c	4.1	83/02/12	*/
2 
3  /* tc.c: find character not in table to delimit fields */
4 # include "t..c"
5 choochar()
6 {
7 /* choose funny characters to delimit fields */
8 int had[128], ilin,icol, k;
9 char *s;
10 for(icol=0; icol<128; icol++)
11 	had[icol]=0;
12 F1 = F2 = 0;
13 for(ilin=0;ilin<nlin;ilin++)
14 	{
15 	if (instead[ilin]) continue;
16 	if (fullbot[ilin]) continue;
17 	for(icol=0; icol<ncol; icol++)
18 		{
19 		k = ctype(ilin, icol);
20 		if (k==0 || k == '-' || k == '=')
21 			continue;
22 		s = table[ilin][icol].col;
23 		if (point(s))
24 		while (*s)
25 			had[*s++]=1;
26 		s=table[ilin][icol].rcol;
27 		if (point(s))
28 		while (*s)
29 			had[*s++]=1;
30 		}
31 	}
32 /* choose first funny character */
33 for(
34 	s="\002\003\005\006\007!%&#/?,:;<=>@`^~_{}+-*ABCDEFGHIJKMNOPQRSTUVWXYZabcdefgjkoqrstwxyz";
35 		*s; s++)
36 	{
37 	if (had[*s]==0)
38 		{
39 		F1= *s;
40 		had[F1]=1;
41 		break;
42 		}
43 	}
44 /* choose second funny character */
45 for(
46 	s="\002\003\005\006\007:_~^`@;,<=>#%&!/?{}+-*ABCDEFGHIJKMNOPQRSTUVWXZabcdefgjkoqrstuwxyz";
47 		*s; s++)
48 	{
49 	if (had[*s]==0)
50 		{
51 		F2= *s;
52 		break;
53 		}
54 	}
55 if (F1==0 || F2==0)
56 	error("couldn't find characters to use for delimiters");
57 return;
58 }
59 point(s)
60 {
61 return(s>= 128 || s<0);
62 }
63