8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / tbl / tb.c
blobb82d7532d0bb1ca7fc598a549322c0807134d2f1
1 /*
2 * Copyright 1991 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
4 */
6 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
7 /* All Rights Reserved */
9 /*
10 * Copyright (c) 1980 Regents of the University of California.
11 * All rights reserved. The Berkeley software License Agreement
12 * specifies the terms and conditions for redistribution.
15 #pragma ident "%Z%%M% %I% %E% SMI"
17 /* tb.c: check which entries exist, also storage allocation */
18 # include "t..c"
19 #include <stdlib.h>
21 void
22 checkuse(void)
24 int i,c, k;
25 for(c=0; c<ncol; c++)
27 used[c]=lused[c]=rused[c]=0;
28 for(i=0; i<nlin; i++)
30 if (instead[i] || fullbot[i]) continue;
31 k = ctype(i,c);
32 if (k== '-' || k == '=') continue;
33 if ((k=='n'||k=='a'))
35 rused[c]|= real(table[i][c].rcol);
36 if( !real(table[i][c].rcol))
37 used[c] |= real(table[i][c].col);
38 if (table[i][c].rcol)
39 lused[c] |= real(table[i][c].col);
41 else
42 used[c] |= real(table[i][c].col);
47 int
48 real(char *s)
50 if (s==0) return(0);
51 if (!point(s)) return(1);
52 if (*s==0) return(0);
53 return(1);
56 int spcount = 0;
58 # define MAXVEC 20
60 char *spvecs[MAXVEC];
62 char *
63 chspace(void)
65 char *pp;
66 if (spvecs[spcount])
67 return(spvecs[spcount++]);
68 if (spcount>=MAXVEC)
69 error(gettext("Too many characters in table"));
70 spvecs[spcount++]= pp = calloc(MAXCHS+MAXSTR,1);
71 if (pp == 0)
72 error(gettext("no space for characters"));
73 return(pp);
76 # define MAXPC 50
78 char *thisvec;
79 int tpcount = -1;
80 char *tpvecs[MAXPC];
82 int *
83 alocv(int n)
85 int *tp, *q;
86 if (tpcount<0 || thisvec+n > tpvecs[tpcount]+MAXCHS)
88 tpcount++;
89 if (tpvecs[tpcount]==0)
91 tpvecs[tpcount] = calloc(MAXCHS,1);
93 thisvec = tpvecs[tpcount];
94 if (thisvec == 0)
95 error(gettext("no space for vectors"));
97 tp=(int *)thisvec;
98 thisvec+=n;
99 for(q=tp; q<(int *)thisvec; q++)
100 *q=0;
101 return(tp);
104 void
105 release(void)
107 extern char *exstore;
108 /* give back unwanted space in some vectors */
109 spcount=0;
110 tpcount= -1;
111 exstore=0;