1*b5514887Smuffin /* 2*b5514887Smuffin * Copyright 1991 Sun Microsystems, Inc. All rights reserved. 3*b5514887Smuffin * Use is subject to license terms. 4*b5514887Smuffin */ 5*b5514887Smuffin 67c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 77c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 87c478bd9Sstevel@tonic-gate 97c478bd9Sstevel@tonic-gate /* 107c478bd9Sstevel@tonic-gate * Copyright (c) 1980 Regents of the University of California. 117c478bd9Sstevel@tonic-gate * All rights reserved. The Berkeley software License Agreement 127c478bd9Sstevel@tonic-gate * specifies the terms and conditions for redistribution. 137c478bd9Sstevel@tonic-gate */ 147c478bd9Sstevel@tonic-gate 15*b5514887Smuffin #pragma ident "%Z%%M% %I% %E% SMI" 167c478bd9Sstevel@tonic-gate 177c478bd9Sstevel@tonic-gate /* tb.c: check which entries exist, also storage allocation */ 187c478bd9Sstevel@tonic-gate # include "t..c" 19*b5514887Smuffin #include <stdlib.h> 20*b5514887Smuffin 21*b5514887Smuffin void 22*b5514887Smuffin checkuse(void) 237c478bd9Sstevel@tonic-gate { 247c478bd9Sstevel@tonic-gate int i,c, k; 257c478bd9Sstevel@tonic-gate for(c=0; c<ncol; c++) 267c478bd9Sstevel@tonic-gate { 277c478bd9Sstevel@tonic-gate used[c]=lused[c]=rused[c]=0; 287c478bd9Sstevel@tonic-gate for(i=0; i<nlin; i++) 297c478bd9Sstevel@tonic-gate { 307c478bd9Sstevel@tonic-gate if (instead[i] || fullbot[i]) continue; 317c478bd9Sstevel@tonic-gate k = ctype(i,c); 327c478bd9Sstevel@tonic-gate if (k== '-' || k == '=') continue; 337c478bd9Sstevel@tonic-gate if ((k=='n'||k=='a')) 347c478bd9Sstevel@tonic-gate { 357c478bd9Sstevel@tonic-gate rused[c]|= real(table[i][c].rcol); 367c478bd9Sstevel@tonic-gate if( !real(table[i][c].rcol)) 377c478bd9Sstevel@tonic-gate used[c] |= real(table[i][c].col); 387c478bd9Sstevel@tonic-gate if (table[i][c].rcol) 397c478bd9Sstevel@tonic-gate lused[c] |= real(table[i][c].col); 407c478bd9Sstevel@tonic-gate } 417c478bd9Sstevel@tonic-gate else 427c478bd9Sstevel@tonic-gate used[c] |= real(table[i][c].col); 437c478bd9Sstevel@tonic-gate } 447c478bd9Sstevel@tonic-gate } 457c478bd9Sstevel@tonic-gate } 46*b5514887Smuffin 47*b5514887Smuffin int 48*b5514887Smuffin real(char *s) 497c478bd9Sstevel@tonic-gate { 507c478bd9Sstevel@tonic-gate if (s==0) return(0); 517c478bd9Sstevel@tonic-gate if (!point(s)) return(1); 527c478bd9Sstevel@tonic-gate if (*s==0) return(0); 537c478bd9Sstevel@tonic-gate return(1); 547c478bd9Sstevel@tonic-gate } 55*b5514887Smuffin 567c478bd9Sstevel@tonic-gate int spcount = 0; 57*b5514887Smuffin 587c478bd9Sstevel@tonic-gate # define MAXVEC 20 59*b5514887Smuffin 607c478bd9Sstevel@tonic-gate char *spvecs[MAXVEC]; 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate char * 63*b5514887Smuffin chspace(void) 647c478bd9Sstevel@tonic-gate { 657c478bd9Sstevel@tonic-gate char *pp; 667c478bd9Sstevel@tonic-gate if (spvecs[spcount]) 677c478bd9Sstevel@tonic-gate return(spvecs[spcount++]); 687c478bd9Sstevel@tonic-gate if (spcount>=MAXVEC) 697c478bd9Sstevel@tonic-gate error(gettext("Too many characters in table")); 707c478bd9Sstevel@tonic-gate spvecs[spcount++]= pp = calloc(MAXCHS+MAXSTR,1); 717c478bd9Sstevel@tonic-gate if (pp == 0) 727c478bd9Sstevel@tonic-gate error(gettext("no space for characters")); 737c478bd9Sstevel@tonic-gate return(pp); 747c478bd9Sstevel@tonic-gate } 75*b5514887Smuffin 767c478bd9Sstevel@tonic-gate # define MAXPC 50 77*b5514887Smuffin 787c478bd9Sstevel@tonic-gate char *thisvec; 797c478bd9Sstevel@tonic-gate int tpcount = -1; 807c478bd9Sstevel@tonic-gate char *tpvecs[MAXPC]; 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate int * 83*b5514887Smuffin alocv(int n) 847c478bd9Sstevel@tonic-gate { 857c478bd9Sstevel@tonic-gate int *tp, *q; 867c478bd9Sstevel@tonic-gate if (tpcount<0 || thisvec+n > tpvecs[tpcount]+MAXCHS) 877c478bd9Sstevel@tonic-gate { 887c478bd9Sstevel@tonic-gate tpcount++; 897c478bd9Sstevel@tonic-gate if (tpvecs[tpcount]==0) 907c478bd9Sstevel@tonic-gate { 917c478bd9Sstevel@tonic-gate tpvecs[tpcount] = calloc(MAXCHS,1); 927c478bd9Sstevel@tonic-gate } 937c478bd9Sstevel@tonic-gate thisvec = tpvecs[tpcount]; 947c478bd9Sstevel@tonic-gate if (thisvec == 0) 957c478bd9Sstevel@tonic-gate error(gettext("no space for vectors")); 967c478bd9Sstevel@tonic-gate } 977c478bd9Sstevel@tonic-gate tp=(int *)thisvec; 987c478bd9Sstevel@tonic-gate thisvec+=n; 997c478bd9Sstevel@tonic-gate for(q=tp; q<(int *)thisvec; q++) 1007c478bd9Sstevel@tonic-gate *q=0; 1017c478bd9Sstevel@tonic-gate return(tp); 1027c478bd9Sstevel@tonic-gate } 103*b5514887Smuffin 104*b5514887Smuffin void 105*b5514887Smuffin release(void) 1067c478bd9Sstevel@tonic-gate { 1077c478bd9Sstevel@tonic-gate extern char *exstore; 1087c478bd9Sstevel@tonic-gate /* give back unwanted space in some vectors */ 1097c478bd9Sstevel@tonic-gate spcount=0; 1107c478bd9Sstevel@tonic-gate tpcount= -1; 1117c478bd9Sstevel@tonic-gate exstore=0; 1127c478bd9Sstevel@tonic-gate } 113