Lines Matching refs:g
29 struct re_guts *g; member
94 register struct re_guts *g; variable
116 g = (struct re_guts *)malloc(sizeof(struct re_guts) +
118 if (g == NULL)
124 free((char *) g);
132 free((char *)g);
137 p->g = g;
146 g->csetsize = NC;
147 g->sets = NULL;
148 g->setbits = NULL;
149 g->ncsets = 0;
150 g->cflags = cflags;
151 g->iflags = 0;
152 g->nbol = 0;
153 g->neol = 0;
154 g->must = NULL;
155 g->mlen = 0;
156 g->nsub = 0;
157 g->ncategories = 1; /* category 0 is "everything else" */
158 g->categories = &g->catspace[0];
159 (void) memset((char *)g->catspace, 0, NC*sizeof(cat_t));
160 g->backrefs = 0;
164 g->firststate = THERE();
172 g->laststate = THERE();
175 categorize(p, g);
176 stripsnug(p, g);
177 findmust(p, g);
178 g->nplus = pluscount(p, g);
179 g->magic = MAGIC2;
180 preg->re_nsub = g->nsub;
181 preg->re_g = g;
185 if (g->iflags&BAD)
263 p->g->nsub++;
264 subno = p->g->nsub;
291 p->g->iflags |= USEBOL;
292 p->g->nbol++;
297 p->g->iflags |= USEEOL;
298 p->g->neol++;
309 if (p->g->cflags®_NEWLINE)
427 p->g->iflags |= USEBOL;
428 p->g->nbol++;
437 p->g->iflags |= USEEOL;
438 p->g->neol++;
471 if (p->g->cflags®_NEWLINE)
483 p->g->nsub++;
484 subno = p->g->nsub;
514 assert(i <= p->g->nsub);
523 p->g->backrefs = 1;
623 if (p->g->cflags®_ICASE) {
627 for (i = p->g->csetsize - 1; i >= 0; i--)
639 for (i = p->g->csetsize - 1; i >= 0; i--)
644 if (p->g->cflags®_NEWLINE)
878 register cat_t *cap = p->g->categories;
880 if ((p->g->cflags®_ICASE) && isalpha(ch) && othercase(ch) != ch)
885 cap[ch] = p->g->ncategories++;
1011 register int no = p->g->ncsets++;
1015 register size_t css = (size_t)p->g->csetsize;
1023 if (p->g->sets == NULL)
1024 p->g->sets = (cset *)malloc(nc * sizeof(cset));
1026 p->g->sets = (cset *)realloc((unsigned char *)p->g->sets,
1028 if (p->g->setbits == NULL)
1029 p->g->setbits = (uch *)malloc(nbytes);
1031 p->g->setbits = (uch *)realloc((unsigned char *)p->g->setbits,
1035 p->g->sets[i].ptr = p->g->setbits + css*(i/CHAR_BIT);
1037 if (p->g->sets != NULL && p->g->setbits != NULL)
1038 (void) memset((unsigned char *)p->g->setbits + (nbytes - css),
1047 assert(p->g->sets != NULL); /* xxx */
1048 cs = &p->g->sets[no];
1049 cs->ptr = p->g->setbits + css*((no)/CHAR_BIT);
1068 register cset *top = &p->g->sets[p->g->ncsets];
1069 register size_t css = (size_t)p->g->csetsize;
1074 p->g->ncsets--;
1094 register cset *top = &p->g->sets[p->g->ncsets];
1096 register size_t css = (size_t)p->g->csetsize;
1099 for (cs2 = &p->g->sets[0]; cs2 < top; cs2++)
1114 return((int)(cs - p->g->sets));
1127 register size_t css = (size_t)p->g->csetsize;
1146 register size_t css = (size_t)p->g->csetsize;
1278 isinsets(g, c) in isinsets() argument
1279 register struct re_guts *g; in isinsets()
1284 register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
1287 if (!g->setbits) {
1291 for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
1302 samesets(g, c1, c2) in samesets() argument
1303 register struct re_guts *g; in samesets()
1309 register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
1313 for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
1324 categorize(p, g) in categorize() argument
1326 register struct re_guts *g;
1328 register cat_t *cats = g->categories;
1338 if (cats[c] == 0 && isinsets(g, c)) {
1339 cat = g->ncategories++;
1342 if (cats[c2] == 0 && samesets(g, c, c2))
1487 stripsnug(p, g) in stripsnug() argument
1489 register struct re_guts *g;
1491 g->nstates = p->slen;
1492 g->strip = (sop *)realloc((unsigned char *)p->strip, p->slen * sizeof(sop));
1493 if (g->strip == NULL) {
1495 g->strip = p->strip;
1510 findmust(p, g) in findmust() argument
1512 register struct re_guts *g;
1528 scan = g->strip + 1;
1550 g->iflags |= BAD;
1556 if (newlen > g->mlen) { /* ends one */
1558 g->mlen = newlen;
1565 if (g->mlen == 0) /* there isn't one */
1569 g->mlen = 0;
1574 g->must = malloc((size_t)g->mlen + 1);
1575 if (g->must == NULL) { /* argh; just forget it */
1576 g->mlen = 0;
1579 cp = g->must;
1581 for (i = g->mlen; i > 0; i--) {
1584 assert(cp < g->must + g->mlen);
1587 assert(cp == g->must + g->mlen);
1596 pluscount(p, g) in pluscount() argument
1598 register struct re_guts *g;
1608 scan = g->strip + 1;
1623 g->iflags |= BAD;