/* * Copyright 1991 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ /* * Copyright (c) 1980 Regents of the University of California. * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ #pragma ident "%Z%%M% %I% %E% SMI" /* tb.c: check which entries exist, also storage allocation */ # include "t..c" #include void checkuse(void) { int i,c, k; for(c=0; c=MAXVEC) error(gettext("Too many characters in table")); spvecs[spcount++]= pp = calloc(MAXCHS+MAXSTR,1); if (pp == 0) error(gettext("no space for characters")); return(pp); } # define MAXPC 50 char *thisvec; int tpcount = -1; char *tpvecs[MAXPC]; int * alocv(int n) { int *tp, *q; if (tpcount<0 || thisvec+n > tpvecs[tpcount]+MAXCHS) { tpcount++; if (tpvecs[tpcount]==0) { tpvecs[tpcount] = calloc(MAXCHS,1); } thisvec = tpvecs[tpcount]; if (thisvec == 0) error(gettext("no space for vectors")); } tp=(int *)thisvec; thisvec+=n; for(q=tp; q<(int *)thisvec; q++) *q=0; return(tp); } void release(void) { extern char *exstore; /* give back unwanted space in some vectors */ spcount=0; tpcount= -1; exstore=0; }