Subversion Repositories planix.SVN

Rev

Details | Last modification | View Log | RSS feed

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