Commit | Line | Data |
---|---|---|
94bed826 KB |
1 | /*- |
2 | * %sccs.include.proprietary.c% | |
3 | */ | |
4 | ||
476fcd16 | 5 | #ifndef lint |
94bed826 KB |
6 | static char sccsid[] = "@(#)tb.c 4.6 (Berkeley) %G%"; |
7 | #endif /* not lint */ | |
96529df1 BS |
8 | |
9 | /* tb.c: check which entries exist, also storage allocation */ | |
10 | # include "t..c" | |
11 | checkuse() | |
12 | { | |
13 | int i,c, k; | |
14 | for(c=0; c<ncol; c++) | |
15 | { | |
16 | used[c]=lused[c]=rused[c]=0; | |
17 | for(i=0; i<nlin; i++) | |
18 | { | |
19 | if (instead[i] || fullbot[i]) continue; | |
20 | k = ctype(i,c); | |
21 | if (k== '-' || k == '=') continue; | |
22 | if ((k=='n'||k=='a')) | |
23 | { | |
24 | rused[c]|= real(table[i][c].rcol); | |
25 | if( !real(table[i][c].rcol)) | |
26 | used[c] |= real(table[i][c].col); | |
27 | if (table[i][c].rcol) | |
28 | lused[c] |= real(table[i][c].col); | |
29 | } | |
30 | else | |
31 | used[c] |= real(table[i][c].col); | |
32 | } | |
33 | } | |
34 | } | |
35 | real(s) | |
36 | char *s; | |
37 | { | |
38 | if (s==0) return(0); | |
39 | if (!point(s)) return(1); | |
40 | if (*s==0) return(0); | |
41 | return(1); | |
42 | } | |
43 | int spcount = 0; | |
44 | extern char * calloc(); | |
45 | # define MAXVEC 20 | |
46 | char *spvecs[MAXVEC]; | |
496e6be8 JB |
47 | |
48 | char * | |
96529df1 BS |
49 | chspace() |
50 | { | |
51 | char *pp; | |
52 | if (spvecs[spcount]) | |
53 | return(spvecs[spcount++]); | |
54 | if (spcount>=MAXVEC) | |
55 | error("Too many characters in table"); | |
56 | spvecs[spcount++]= pp = calloc(MAXCHS+200,1); | |
bdbc9c90 | 57 | if (pp == 0) |
96529df1 BS |
58 | error("no space for characters"); |
59 | return(pp); | |
60 | } | |
61 | # define MAXPC 50 | |
62 | char *thisvec; | |
63 | int tpcount = -1; | |
64 | char *tpvecs[MAXPC]; | |
496e6be8 JB |
65 | |
66 | int * | |
96529df1 BS |
67 | alocv(n) |
68 | { | |
69 | int *tp, *q; | |
70 | if (tpcount<0 || thisvec+n > tpvecs[tpcount]+MAXCHS) | |
71 | { | |
72 | tpcount++; | |
73 | if (tpvecs[tpcount]==0) | |
74 | { | |
75 | tpvecs[tpcount] = calloc(MAXCHS,1); | |
76 | } | |
77 | thisvec = tpvecs[tpcount]; | |
bdbc9c90 | 78 | if (thisvec == 0) |
96529df1 BS |
79 | error("no space for vectors"); |
80 | } | |
d4cdb00e | 81 | tp=(int *)thisvec; |
96529df1 | 82 | thisvec+=n; |
d4cdb00e | 83 | for(q=tp; q<(int *)thisvec; q++) |
96529df1 BS |
84 | *q=0; |
85 | return(tp); | |
86 | } | |
87 | release() | |
88 | { | |
89 | extern char *exstore; | |
90 | /* give back unwanted space in some vectors */ | |
91 | spcount=0; | |
92 | tpcount= -1; | |
93 | exstore=0; | |
94 | } |